问题:
使用 hexo + next-theme + Github Page
搭建博客在收尾阶段碰到一点小问题,菜单栏的Tags
和 Categories
链接无法正常显示,而是直接跳转到404页面。
解决方法:
hexo 默认
source
文件中是没有tags
和categories
对应的page文件的,我们需要先手动进行创建,使用命令行:1
2hexo new page categories
hexo new page tags接下来设置在
source
目录下的tags\index.md
和categories\index.md
文件。 在文件最上方的front-matter
(顶部代码片段)中加上对应的type
类型。 比如对于tags\index.md
加上type: tags
, 对于categories\index.md
加上type: categories
。
测试: 使用
hexo new xxx
新建一个博客文章,在文件最上方的front-matter
(顶部代码片段)中加上对应的tags
和categories
, 比如:1
2tags: hello world
categories: hello world
使用
hexo g
重新生成静态文件,再重新部署hexo d
,打开博客,可以看到菜单中Tags
和Categories
成功生成。