Skip to content

Frontmatter

所有属性

Frontmatter 位于 Markdown 文件的最开头,声明了当前文章的各种属性。

提示

斜体 为 VitePress 默认主题自带的 Frontmatter

参数名必填默认值备注
draft设置为 true 时,自动添加到 srcExclude 中,排除构建
hidden设置为 true 时,隐藏文章(仅在文章列表中隐藏)
order置顶文章排序,数字越小越靠前,不能为 0
pinned置顶文章文本描述
password文章密码
id自动生成6 位随机字符文章 ID
title自动生成文件名文章标题
datetime自动生成文件创建时间发布时间
permalink永久链接
outlineconfig.ts 中设置的值目录标题的级别
description文章描述(自定义摘要内容)
category分类
tags标签
prev若在 usePosts 中设置 nav: true,会自动生成上一页
next同上下一页
headHTML 中的 head

示例

yaml
---
draft: true
hidden: true
order: 1
pinned: '置顶'
password: 123456
id: 123456
title: VitePress Theme Minimalism 使用文档   
datetime: '2024/01/01 10:00:00'
permalink: /posts/minimalism
outline: deep
description: '自定义摘要内容'
category: 分类 A
tags: 
  - 标签 A
  - 标签 B
prev:
  text: 上一篇文章标题
  link: /posts/prev
next:
  text: 下一篇文章标题
  link: /posts/next
head:
  - - meta
    - name: robots
      content: 'noindex, nofollow'
---
关注微信公众号