1.必备工具
git --version
//输出git 版本
git version 2.19.1.windows.1
node -v
//输出node 版本
v10.13.0
2.借助hexo
插件搭建博客
- 打开
git
cnpm install -g hexo-cli//全局安装
- 选择一个目录创建自己的
blog
文件夹
image.png
然后在用git
进入该文件夹中,依次如下输入
hexo init //初始化该文件夹为博客文件夹
hexo generate //
hexo server//开启服务器访问这个blog
打开浏览器输入http://localhost:4000
即可访问
image.png
3.上传到github
实现在线浏览
1. 注意:此处要重新配置ssh key
2.找到_config.yml文件,在该文件最后修改如下
deploy:
type: git
repo: git@github.com:huhailin666/huhailin666.github.io.git//改成自己的仓库地址
branch: master
3.安装hexo-deployer-git
插件
cnpm install hexo-deployer-git --save
4.部署到Github上
依次执行
hexo clean #清除缓存 网页正常情况下可以忽略此条命令
hexo generate #生成静态页面至public目录
hexo deploy
ok 已经上传成功了
4.博客页面美化
此时页面样式很单一,为追求个性,我们可以对其进行修改。
一般使用next
提供的插件来修改
1.安装next
$ git clone https://github.com/iissnan/hexo-theme-next themes/next//直接安装将插件安装在themes的next文件下
1.配置主题
地址myBlog\themes\next下的_config.yml
找到Scheme
,外观,默认Muse,这里我修改为Gemini
# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini
查看效果
hexo clean #清除缓存
hexo generate #生成静态网页
hexo server #本地预览