Front-matter

Front-matter 是 markdown 文件最上方以 — 分隔的区域,用于指定个别档案的变数。

  • Page Front-matter 用于 配置页面

  • Post Front-matter 用于 配置文章页

Page Front-matter:

[needed]

title: 页面标题
date:页面创建日期
type:标签、分类和友情链接三个页面需要配置

[selected]

updated:页面更新日期
comments:显示页面评论模块(默认为true)
description:页面描述
keywords:页面关键词
top_img:页面顶部图片
mathjax:显示mathjax(当设置 mathjax 的 per_page: false 时,才需要配置,默认 false)
katex:显示 katex (当设置 katex 的 per_page: false 时,才需要配置,默认 false)
aside:显示侧边栏 (默认 true)
aplayer:在需要的页面加载 aplayer 的 js 和 css,参考下面的配置:音乐
highlight_shrink:配置代码框是否展开 (true/false) (默认为设置中 highlight_shrink 的配置)
random:配置友情链接是否随机排序(默认为 false)
limit:配置说显示数量
limit.type:配置说显示数量的类型 (date 或者 num)
limit.value:配置说显示数量的值

Post Front-matter:

[needed]

title:标题
date:创建日期

[selected]

updated:更新日期
tags:标签
categories:分类
keywords:关键词
description:描述
top_img:顶部图片
comments:显示文章评论模块(默认 true)
cover:文章缩略图(如果没有设置 top_img,文章页顶部将显示缩略图,可设为 false/图片地址/留空)
toc:显示文章 TOC(默认为设置中 toc 的 enable 配置)
toc_number:显示 toc_number(默认为设置中 toc 的 number 配置)
toc_style_simple:显示 toc 简洁模式
copyright:显示文章版权模块(默认为设置中 post_copyright 的 enable 配置)
copyright_author:文章版权模块的文章作者
copyright_author_href:文章版权模块的链接文章作者
copyright_url:文章版权模块的链接文章链接
copyright_info:文章版权模块的文字版权声明
mathjax:显示 mathjax(当设置 mathjax 的 per_page: false 时,才需要配置,默认 false )
katex:显示 katex (当设置 katex 的 per_page: false 时,才需要配置,默认 false )
aplayer:在需要的页面加载 aplayer 的 js 和 css,请参考文章下面的 配置音乐
highlight_shrink:配置代码框是否展开(true/false)(默认为设置中 highlight_shrink 的配置)
aside:显示侧边栏 (默认 true)
abcjs:加载 abcjs (当设置 abcjs 的 per_page: false 时,才需要配置,默认 false )
noticeOutdate:文章过期提醒 (默认为设置中 noticeOutdate 的 enable 配置)

标签页

标签页文件名不一定是 tags, 例子中的 tags 只是一个示例

记得添加 type: “tags”

1.前往你的 Hexo 的根目录

2.输入 hexo new page tags

3.你会找到 这个文件source/tags/index.md

修改此文档 :

title: 标签
date: 2018-01-05 00:00:00
type: ‘tags’
orderby: random
order: 1


[needed]

type:页面类型,必须为tags

[selected]

orderby:排序方式 :random - 随机排序 / name - 标签名字排序 / length - 标签数量排序
order:排序次序: 1(升序),-1(降序)

注:这里只是创建了一个用来渲染标签页的界面,具体的标签不必再hexo new tag "",只需要在每个post的front-matter中添加tags选项就可以,例如tags:”name”,这里的name可以是任意的名字(下面的分类页同理,只需要在front-matter中加categories选项即可)

分类页

分类页文件名不一定是 categories, 例子中的 categories 只是一个示例
记得添加 type: “categories”

1.前往你的 Hexo 的根目录

2.输入 hexo new page categories

3.你会找到 这个文件source/categories/index.md

修改此文档 :

title: 分类
date: 2018-01-05 00:00:00
type: ‘categories’

以上内容来自:

1
https://butterfly.js.org/posts/dc584b87