How I solve the 'tag page is blank' problem
创建 tags 页面时遇到的问题
正常流程
$ hexo new page "tags"
- 编辑
index.md
:1
2
3title: tag
type: tags
layout: tags - 编辑主题配置文件
nav
:1
2
3
4nav:
Posts: /archives
Categories:
Tags: /tags # 新增
我的 tags 界面会
- 依旧显示
Cannot GET /tags/
- 正常打开但内容空白
解决
- 对于显示
Cannot GET /tags/
,检查是否写了layout: tag
- 对于内容空白,查阅
themes/maple/layout/tag.ejs
,发现作者写道:
this page will judge whether current page is ‘tag.’
url:’http://localhost:4000/tag/‘ return false.
url:’http://localhost:4000/tags/test/‘ return true.
if you enter ‘tag’ page by click link will show all tags.
otherwise if you enter ‘tags’ by click post header link will show the single tag of this post.
how to add a tag page:
1. hexo new page “tag”
2. cd source/tag/index.md
3. add layout pattern like this:1
2
3
4title: tag
date: 2019-06-09 09:56:49
tag: tag
layout: tag
方知要将 tags
改作 tag
对于 category
也是同理