Front Matter

了解如何在 Hexo 博客(旨在本主题中使用)文章中使用 frontmatter。

Front Matter

Front matter 是 Hexo 博客文章和页面的元数据部分,通常位于 Markdown 文件的开头。它使用 YAML 格式来定义文章或页面的属性,如标题、日期、类型、评论等。

示例

文章内
页面内
特色页面
---
title:
date:
type:
comment:
cover:
katex:
reprint:
locate:
---

Front Matter 属性

通用属性

属性类型描述
titlestring
必须
页面/文章标题
datedatetime
必须
页面/文章创建日期
typestring
必须*
页面配置里含type值的/设置banner时需要配置
updateddatetime
可选
页面/文章更新日期
descstring
可选
页面/文章描述
asideboolean
可选
是否开启侧边栏(默认true)
commentboolean
可选
显示页面/文章评论模块(默认 true)
coverstring
可选
文章封面图片URL(横幅图片需要 type 值生效)
reprintboolean
可选
版权(默认为原创)为true时为转载
katexboolean
可选
显示 katex(默认 false)
locatestring
可选
文章创作地点
containerboolean
可选
是否开启容器(启用外挂标签,默认true)

特殊属性

以下仅在 type: banner 以及其他含 type 值页面生效

属性类型描述
leftendstring
可选
banner底部左侧文字
rightendstring
可选
banner底部右侧文字
rightbtnstring
可选
banner底部右侧按钮文字
rightbtnlinkstring
可选
banner底部右侧按钮跳转链接