本文最后更新于:2024年1月14日 晚上

Next主题支持文章按照类别划分,而且可以为文章添加标签,并且有专门的页面用来管理和检索。而新安装的Next主题不带about, tags, categories页面,默认只有Archives。本文介绍这些页面的添加方法。

开启菜单按钮

主题配置文件中开启相应按钮(去掉行前的#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ---------------------------------------------------------------
# Menu Settings
# ---------------------------------------------------------------

# Usage: `Key: /link/ || icon`
# Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-senstive.
# Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.
# When running the site in a subdirectory (e.g. yoursite.com/blog), remove the leading slash from link value (/archives -> archives).
# External url should start with http:// or https://
menu:
home: / || home
about: /about/ || user
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive
#schedule: /schedule/ || calendar
#sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat

此时页面菜单发生了一些变化,但是按钮链接没有对应页面

添加页面

添加 tags

在hexo目录的终端输入命令新建文章,layout设置为page,文章名称为tags

1
hexo new page tags

此时在 /hexo_root/source/tags/文件夹中出现了index.md文件,打开并修改Front-matter内容

1
2
3
title: 文章标签
date: 2020-02-28 13:01:59
type: "tags"

此时tags页面已经可以打开

添加 categories

在hexo目录的终端输入命令新建文章,layout设置为page,文章名称为categories

1
hexo new page categories

此时在 /hexo_root/source/categories/文件夹中出现了index.md文件,打开并修改Front-matter内容

1
2
3
title: 文章类别
date: 2020-02-28 13:03:19
type: "categories"

此时categories页面已经可以打开

添加about

在hexo目录的终端输入命令新建文章,layout设置为page,文章名称为about

1
hexo new page about

此时在 /hexo_root/source/about/文件夹中出现了index.md文件,打开并修改Front-matter内容

1
2
3
title: 小站自述
date: 2020-02-28 13:07:35
type: "about"

同时可以在文件中加入站点描述内容

此时about页面已经可以打开

设置文章类别和标签

修改/hexo_root/source/_posts/hello-world.md,在Front-matter中添加标签和类别

1
2
3
title: Hello World
tags: [tag1,tag2]
categories: [cate,sub_cate,sub_sub_cate]

1
2
3
4
5
6
7
8
title: Hello World
tags:
- tag1
- tag2
categories:
- cate
- sub_cate
- sub_sub_cate

主页面侧边栏状态会发生变化

标签页面(标签内容数量多字体会相应变大)

一篇文章可以设置多个平行标签

分类页面

类别标签不并列,安装顺序设置级别

关闭评论

后续站点可能会开启评论功能,如果不希望上述页面开启评论可以在页面index.md的Front-matter中添加

1
comments: false


文章链接:
https://www.zywvvd.com/notes/hexo/theme/next/2-add-pages/add-tags-about-categories-page/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

Next -2- 增加 tags, about, categories 页面
https://www.zywvvd.com/notes/hexo/theme/next/2-add-pages/add-tags-about-categories-page/
作者
Yiwei Zhang
发布于
2020年2月28日
许可协议