mirror of https://github.com/vuejs/vitepress
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4.0 KiB
4.0 KiB
| outline |
|---|
| deep |
Frontmatter 配置
Frontmatter 支持基于页面的配置。在每个 markdown 文件中,你可以使用 frontmatter 配置来覆写站点级别或主题级别的配置选项。此外,还有一些配置选项只能在 frontmatter 中定义。
示例用法:
---
title: Docs with VitePress
editLink: true
---
你可以通过 Vue 表达式中的 $frontmatter 全局变量访问 frontmatter 数据:
{{ $frontmatter.title }}
标题
- key:
title - Type:
string
Title for the page. It's same as config.title, and it overrides the site-level config.
---
title: VitePress
---
标题模板
- key:
titleTemplate - Type:
string | boolean
标题的后缀。它与 config.titleTemplate 相同,它会覆盖站点级别的配置。
---
title: VitePress
titleTemplate: Vite & Vue powered static site generator
---
描述
- key:
description - Type:
string
页面的描述。它与 config.description 相同,它会覆盖站点级别的配置。
---
description: VitePress
---
头部标签
- key:
head - Type:
HeadConfig[]
指定要为当前页面注入的额外 head 标签。将附加在站点级配置注入的头部标签之后。
---
head:
- - meta
- name: description
content: hello
- - meta
- name: keywords
content: super duper SEO
---
type HeadConfig = [string, Record<string, string>] | [string, Record<string, string>, string]
仅默认主题
以下 frontmatter 选项仅在使用默认主题时适用。
布局
- key:
layout - Type:
doc | home | page - Default:
doc
指定页面的布局。
doc- 它将默认文档样式应用于 markdown 内容。home- “主页”的特殊布局。你可以添加额外的选项,例如hero和features,以快速创建漂亮的落地页。page- 表现类似于doc,但它不对内容应用任何样式。当你想创建一个完全自定义的页面时很有用。
---
layout: doc
---
hero
当 layout 设置为 home 时,定义主页 hero 部分的内容。更多详细信息:默认主题:主页。
features
定义当layout 设置为 home 时要在 features 部分中显示的项目。更多详细信息:默认主题:主页。
大纲开关
- key:
aside - Type:
boolean | 'left' - Default:
true
定义 aside 组件在 doc 布局中的位置。
将此值设置为 false 可禁用 aside 容器。
将此值设置为 true 会将 aside 渲染到右侧。
将此值设置为 left 会将 aside 渲染到左侧。
---
aside: false
---
大纲层级
- key:
outline - Type:
number | [number, number] | 'deep' | false - Default:
2
大纲中显示的标题级别。它与 config.themeConfig.outline 相同,它会覆盖主题配置。
最近更新时间
- key:
lastUpdated - Type:
boolean - Default:
true
是否在当前页面的页脚中显示最近更新时间的文本。
---
lastUpdated: false
---
编辑链接
- key:
editLink - Type:
boolean - Default:
true
是否在当前页的页脚显示编辑链接。
---
editLink: false
---