首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Next -2- 增加 tags, about, categories 页面

Next -2- 增加 tags, about, categories 页面

作者头像
为为为什么
发布于 2022-08-04 14:08:26
发布于 2022-08-04 14:08:26
1.1K0
举报
文章被收录于专栏:又见苍岚又见苍岚

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

开启菜单按钮

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

代码语言:javascript
复制
# ---------------------------------------------------------------
# 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

代码语言:javascript
复制
hexo new page tags

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

代码语言:javascript
复制
title: 文章标签
date: 2020-02-28 13:01:59
type: "tags"

此时tags页面已经可以打开

添加 categories

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

代码语言:javascript
复制
hexo new page categories

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

代码语言:javascript
复制
title: 文章类别
date: 2020-02-28 13:03:19
type: "categories"

此时categories页面已经可以打开

添加about

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

代码语言:javascript
复制
hexo new page about

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

代码语言:javascript
复制
title: 小站自述
date: 2020-02-28 13:07:35
type: "about"

同时可以在文件中加入站点描述内容 此时about页面已经可以打开

设置文章类别和标签

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

代码语言:javascript
复制
title: Hello World
tags: [tag1,tag2]
categories: [cate,sub_cate,sub_sub_cate]

或

代码语言:javascript
复制
title: Hello World
tags: 
- tag1
- tag2
categories: 
- cate
- sub_cate
- sub_sub_cate

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

标签页面(标签内容数量多字体会相应变大) 一篇文章可以设置多个平行标签

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

关闭评论

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

代码语言:javascript
复制
comments: false
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020年2月28日,如有侵权请联系 cloudcommunity@tencent.com 删除
目录
  • 开启菜单按钮
  • 添加页面
    • 添加 tags
    • 添加 categories
    • 添加about
  • 设置文章类别和标签
  • 关闭评论
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档