Skip to content

Frontmatter

Vitepress已经给了一个配置,就在我们的 中docs - index.md

官方配置示例
---
layout: home

hero:
  name: "My Awesome Project"
  text: "A VitePress Site"
  tagline: My great project tagline
  actions:
    - theme: brand
      text: Markdown Examples
      link: /markdown-examples
    - theme: alt
      text: API Examples
      link: /api-examples

features:
  - title: Feature A
    details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
  - title: Feature B
    details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
  - title: Feature C
    details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

基本示例

上下必须包含 ,中间添加内容---

比如:语言 / 标题 / 自定义标题 / 站点描述

---
lang: zh-CN
title: VitePress
titleTemplate: Vite 和 Vue 强力驱动的静态网站生成器
description: 简单、强大、快速。满足你一直想要的现代SSG框架
---

指定要为当前页面注入的额外头标签。将附加在站点级配置注入的头标签之后

---
head: 
  - - meta
    - name: description
      content: hello
  - - meta
    - name: keywords
      content: super duper SEO
---

首页

  • home 就是首页

  • doc 是文档页

  • page 是无样式的文档,自定义页面

---
layout: home
---
---
layout: doc
---
---
layout: page
---

导航栏

默认 开启,可以选择关闭,仅在当前文档不显示

---
navbar: false
---
---
navbar: true
---

侧边栏

默认 开启,可以选择关闭,仅在当前文档不显示

---
sidebar: false
---
---
sidebar: true
---

文章目录

侧边目录默认在右侧 ,通过 设置左侧或关闭,默认 asidetrue

---
aside: left
---
---
aside: false
---

上/下页

默认从侧边栏配置中读取,也可以指定在上/下页显示的文本/链接

注:

  • prev 表示上一页

  • next 表示下一页

自定义页面内 上/下一页名称 (仅在当前文档生效)

---
prev: '自定义上一页显示名称'
next: '自定义下一页显示名称'
---

更改文字显示并跳转指定页 (仅在当前文档生效)

---
prev: 
  text: '自定义上一页页面'
  link: '/页面路径'
next:
  text: '自定义上一页页面'
  link: '/页面路径'
---

关闭页面内上/下页显示 (仅在当前文档不显示)

---
prev: false
next: false
---

页脚

不想显示可以选择关闭,(仅在当前文档不显示)

---
footer: false
---