如何使用Hexo
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Install Hexo
1 | npm install -g hexo-cli |
Create a new post
1 | $ hexo new "My New Post" |
用new命令创建文章时,会将中间空格替换为横杠-,上述命令最终生成文件名为:”My-New-Post.md”. 创建时可以不用包含双引号,生成的文件取的最后一个单词,例如:hexo new how to use google,命令生成的文件为:google.md.
创建时最好使用英文,英文相对中文来说生成的Url更友好些。
More info: Writing
Run server
1 | $ hexo server |
More info: Server
Clean
1 | $ hexo clean |
clean命令用于清除publish文件中已经生成的文件和清除缓存文件。
Generate static files
1 | $ hexo generate |
More info: Generating
Deploy to remote sites
Deploy前需要安装hexo-deployer-git插件
npm install hexo-deployer-git –save
删除本地存在的.deploy_git
将远程的git仓库克隆到本地
git clone https://github.com/yuanrui/yuanrui.github.io.git .deploy_git
同时需要配置_config.yml文件中deploy设置
注意:冒号后面需要有空格!!!坑1
2
3
4
5
6
7
8
9
10
11
12deploy:
type: git
repo:
#github: git@github.com:yuanrui/yuanrui.github.io.git
github: https://github.com/yuanrui/yuanrui.github.io.git
branch: master
name: yuanrui
```
发布时使用
``` bash
$ hexo deploy
More info: Deployment
安装插件
安装Rss插件1
npm install hexo-generator-feed --save
安装github-card插件1
npm install hexo-github-card
参考:
http://www.jianshu.com/p/ba76165ca84d
https://gist.github.com/yuanrui/1a32715d562c6b2b8ac00a7a91958dc7