Hexo搭建博客

Install Hexo

node.js安装

1
2
$ curl https://raw.github.com/creationix/nvm/master/install.sh | sh
$ nvm install stable

Windows 用户下载 安装程序 来安装

hexo客户端安装

cnpm (gzip 压缩支持) 命令行工具代替默认的 npm,使用淘宝 NPM 镜像

1
2
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
$ cnpm install -g hexo-cli

初始化建站

1
$ hexo init <folder>

或者使用备份,当前用GitHub举例master为站点静态数据,源码备份在分支 sources

1
2
git clone git@github.com:xxx/<folder>.git
git checkout sources
1
2
$ cd <folder>
$ cnpm install

注意: 如需要上传特殊文件到站点根目录如CNAMEfavicon.ico等文件可预先放入到source目录,备份时应包含以下文件和文件夹;

1
2
3
4
5
6
7
8
9
.
├── _config.yml
├── package.json
├── .gitignore
├── scaffolds
├── source
| ├── _drafts
| └── _posts
└── themes

github搭建hexo站点参考
手册
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

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment