How I solve the 'tag page is blank' problem
Eiaton

创建 tags 页面时遇到的问题

正常流程

  1. $ hexo new page "tags"
  2. 编辑 index.md :
    1
    2
    3
    title: tag
    type: tags
    layout: tags
  3. 编辑主题配置文件 nav:
    1
    2
    3
    4
    nav:
    Posts: /archives
    Categories:
    Tags: /tags # 新增

我的 tags 界面会

  • 依旧显示 Cannot GET /tags/
  • 正常打开但内容空白

解决

  1. 对于显示 Cannot GET /tags/,检查是否写了 layout: tag
  2. 对于内容空白,查阅 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
    4
    title: tag
    date: 2019-06-09 09:56:49
    tag: tag
    layout: tag

方知要将 tags 改作 tag

对于 category 也是同理