It’s a tool that supports generating static HTML from Markdown, which makes it suitable to publish personal blog on website (e.g. github-pages).
Installation
1 | npm install -g hexo-cli |
Issue of cannot-find-module-DTraceProviderBindings
After playing a hexo project for some time, I happened to try a yarn install
, which may update some underlying dependencies. Then I found hexo didn’t work anymore. The complain is:1
Cannot find module './build/Release/DTraceProviderBindings
I tried:
npm i hexo
. No use.rm -rfd node_modules && npm i
. No use.npm i hexo --no-optional
. It works for me.npm uninstall hexo-cli -g && npm i hexo-cli -g
. It should work but I haven’t tried it.
Workflow
1 | hexo init <folder> |
Deploy to github-pages
It’s better to create a repo (on github) for the hexo project itself and another repo for the generated HTML files so that we can add contents even on different machines.1
2
3npm install --save hexo-deployer-git
// add repo, branch setting to config file
hexo d[eploy]
Theme
There is a dedicate topic on Hexo at Zhihu.com
A good starting point is Next
How to generate category and tag pages (in Next theme)
By default, even enable these two in menu section of the theme config file, you will still get 404 error when nevigating to “categories” or “tags” pages. The reason is due to the missing index.html under the folder of the above two names. The fix is to add pages with hexo new page categories
and hexo new page index
. Then modify the generated index.md to:1
2
3
4
5
6
7// index.md for categories
type: "categories"
comments: false
// index.md for tags
type: "tags"
comments: false