0%

Hexo

Hexo

Hexo的创建使用不多赘述。

With github

Hexo通过hexo d来发布到github,因此github中deploy到的分支是网站目录。也就是deploy后在本地可以看到的.deloy_git
我个人使用了另一个branch来保存hexo项目的原始文件,也就是_config.yml配置,md文档等等。

Q&A

名字解释:
<root>: 指的网页根目录,或者说是hexo deploy到的repo分支根目录。

Q: 遇到网站repo中路径是存在的,比如<root>/categories/index.html确实存在,但是浏览器点击却是404?
A: 可以自行访问尝试下<root>/categories/或者全路径,看看index.html是不是有问题。如果这样就能访问到正常页面,那么问题大概就是缓存了。你可以换个浏览器快速检查下,或清除该页面缓存重试下。

附赠-chrome清除单个页面缓存

chrome的开发者工具-settingNetwork-Disable cache(while DevTools is open),此选项打开后,在你想要调试的页面,打开开发者工具,就不会出现一些奇怪的缓存现象了。

Hexo cmds

1
2
3
4
5
6
7
8
9
npm install -g hexo-cli
cd <blog-source>
npm install
# if ERROR Package xxx is not installed
npm install xxx

hexo new draft <draft_name> # just the name, no .md
# writing, writing, ...
hexo publish <draft_name>
1
hexo clean && hexo d

If you want to delete a post, just delete it in the source folder.

Localhost debug way:

1
hexo s --debug

Hexo writing

link to another post

Ref Include Posts.

1
{% post_link 要跳转文章md文件名(不要后缀) %}