安装 nvm (Node Version Manager)
利用官方脚本
脚本会把 nvm 克隆到 ~/.nvm
1 | $ wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh |
显示安装的实际版本
1 | $ nvm ls |
Update
1 | $ nvm install stable |
安装并初始化 Hexo
1 | $ npm install -g hexo |
进入博客文件夹(assume Documents/gist_src
)
1 | $ hexo init gist_src |
生成静态文件
1 | $ hexo generate/hexo g |
!!! make sure rendering plugins have already been installed
预览
1 | $ hexo s |
安装必要插件
Be noticed, it seems that all the plugins will be intalled under gist_src/node_modules/
To update all the plugins, just
1 | $ npm update |
Renderer
The following renderers seem to be must-have if you need to view the html result locally.
1 | $ npm install hexo-renderer-ejs --save |
MathJax
Show math locally:
1 | $ npm install hexo-renderer-mathjax --save |
修改 _config.yml
1 | plugins: |
hexo-tag-asset-res
Hexo tags that enable you to reference files in post asset with relative path
1 | $ npm install hexo-tag-asset-res --save |
使用
发现新终端内总是需要先开启 nvm
1 | $ nvm use [tab] |
CDN 加速
设定归档页面文章的篇数
安装 Hexo 插件。在站点目录下使用 npm install --save
安装如下扩展:
hexo-generator-index
hexo-generator-archive
hexo-generator-tag
安装完成后,在 站点配置文章 中,设定:
index_generator:
per_page: 5
archive_generator:
per_page: 20
yearly: true
monthly: true
tag_generator:
per_page: 10
将 per_page 设定成所需要的篇数