383 字
2 分钟
Next 3 菜单栏
2021-12-14

在目前版本中,菜单栏是默认没有的,我们需要在 Next 主题的配置文件中,对菜单栏进行配置。

配置文件#

老样子,先贴上我对菜单栏的配置:

# 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-sensitive.
# Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.
# External url should start with http:// or https://
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

具体的含义我就不多赘述了,一看就能懂了,也不需要将 home 改成首页,新版的 Next 会自动根据系统语言,修改这些项。

菜单栏中网页点击出现 404#

在默认状态下,hexo 并不会为你生成关于、标签以及分类页面,你需要自行创建:

Terminal window
cd hexo
hexo n page "about"
hexo n page "tags"
hexo n page "categories"

生成完成后,你还需要分别对 tags 以及 categories 进行参数配置:

Terminal window
vim source/tags/index.md

你需要在文件头部信息中,增加 type 项,并将 tags 以及 categories 的 type 项参数,分别修改为 tags 和 categories。

---
title: tags
date: 2021-12-11 15:03:08
type: tags
---

到这里,再使用 hexo 生成静态文件后,就能看到对应的页面了:

Terminal window
hexo g

效果展示#

超 Nice 的!!!

Next 标签页面

Next 3 菜单栏
https://fuwari.vercel.app/posts/建站/hexo/next-3-菜单栏/
作者
Asuwee
发布于
2021-12-14
许可协议
CC BY-NC-SA 4.0