0%

设置分类与标签

首先要在站点配置文件 _config.yml 中打开选项

1
2
3
4
5
6
7
8
9
menu:
home: / || fa fa-home
# about: /about/ || fa fa-user
tags: /tags/ || fa fa-tags
categories: /categories/ || fa fa-th
archives: /archives/ || fa fa-archive
# schedule: /schedule/ || fa fa-calendar
# sitemap: /sitemap.xml || fa fa-sitemap
# commonweal: /404/ || fa fa-heartbeat

因为分类页是没有默认页面的所以需要我们手动创建分类页。

1
$ hexo new page categories

成功后会提示:

1
INFO  Created: ~/blog/source/categories/index.md

这样就创建好了分类页面了。但是这个时候主题还不会识别这个页面为分类页;所以需要编辑这个新建的页面,让主题识别这个页面,并自动为这个页面显示分类。

打开index.md,默认内容是

1
2
3
4
---
title: 分类
date: 2021-08-22 03:05:56
---

添加上type: categories这段代码

1
2
3
4
5
---
title: 分类
date: 2021-08-22 03:05:56
type: categories
---

ok 了

其他页面一样的步骤