安装Hexo博客简易步骤
安装node.js
安装hexo
1
npm install -g hexo-cli
装好hexo后,初始化博客目录
1
hexo init blog
上述命令会在当前目录下新建blog目录,然后把hexo的所有文件放到该目录下
检测安装
1
2
3
4
5hexo new test_my_site #新建一篇名为test_my_site的文章
hexo g #生成,是hexo generate的缩写
hexo s # 启动本地服务,是hexo server的缩写更改主题
1
git clone https://github.com/sanonz/hexo-theme-concise.git themes/concise
下载到blog目录下的themes目录下
更改配置文件,使主题生效
- 在
_config.yml
配置文件中 把theme
值改为concise
. - 复制
themes/concise/_config.example.yml
配置文件为themes/concise/_config.yml
- 在
由于主题是用less编译,更换编译器
1
npm install hexo-renderer-less --save
关联GitHub
1
2
3
4
5
6
7
8
9
10
11
12
13打开站点的配置文件_config.yml,翻到最后修改为:
deploy:
type: git
repo: 这里填入你之前在GitHub上创建仓库的完整路径,记得加上 .git
branch: master
参考如下:
deploy:
type: git
repo: https://github.com/iamxh/iamxh.github.io.git
branch: master安装部署插件
1
npm install hexo-deployer-git --save
部署
1
hexo d #部署,是hexo deploy的缩写