Contents
  1. 1. Quick Start
    1. 1.1. Install Hexo
    2. 1.2. Create a new post
    3. 1.3. Run server
    4. 1.4. Clean
    5. 1.5. Generate static files
    6. 1.6. Deploy to remote sites
    7. 1.7. 安装插件

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
2
3
npm install -g hexo-cli

hexo -v

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
12
deploy:
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

Contents
  1. 1. Quick Start
    1. 1.1. Install Hexo
    2. 1.2. Create a new post
    3. 1.3. Run server
    4. 1.4. Clean
    5. 1.5. Generate static files
    6. 1.6. Deploy to remote sites
    7. 1.7. 安装插件