Blog

通过 Hexo主题使用AirCloudGitHub创建blog.

前提

安装 Node.js 、Git

安装 Hexo

1
$ npm install -g hexo-cli

建立网站

1
2
$ hexo init blog
$ cd hexo

运行服务

1
2
3
$ hexo server
$ ##简写
$ hexo s

浏览器访问: http://localhost:4000

生成静态文件

1
2
3
4
$ hexo generate
$ ##简写
$ hexo g
$ hexo g -d #生成静态文件并部署

github账号

创建github账号,并配置能在本地git push

创建项目 xxx.github.io

部署到github

1
2
3
4
5
6
7
8
9
10
11
$ #要安装 hexo-deployer-git
$ npm install hexo-deployer-git --save
# #配置 _config.yml
# deploy:
# type: git
# repository: git@github.com:xxx.github.io.git 或者 https://github.com/xxx.github.io.git
# branch: master
$ hexo deploy
$ ##简写
$ hexo d
$ hexo d -g #生成静态文件并部署

清除文件

1
$ hexo clean

清除缓存文件 (db.json) 和已生成的静态文件 (public)

在某些情况(尤其是更换主题后),如果发现您对站点的更改无论如何也不生效,您可能需要运行该命令。