Skip to content

Frontmatter

Frontmatter configures a single page, while the theme options configure the whole site. The fields documented on this page are the ones the theme reads; fields of the VuePress core and of the plugins (title, lang, description, head, icon, date, …) work as usual and are not repeated here.

---
type: doc
outline: [2, 3]
editLink: false
---

# Page Title

Page Type

type'home' | 'doc' | 'page' | 'content'
Default'doc'

The layout the page renders. The theme registers a single layout and switches the shell from this field:

  • home: the home page shell — hero, features, then the page content.
  • doc: the document page shell — the article with the outline aside and the document footer. This is the default.
  • page: the page shell — the markdown content only, without the outline aside and the document footer.
  • content: no layout shell at all. The page renders the bare markdown content, without navbar, sidebar or footer.
layoutstring

The name of a custom layout registered in a client config. When it is set, type is not used and the layout renders the page itself.

A page with type: content is useful for standalone pages such as a full-screen demo. A page with a custom layout is explained in Extending.

Home Page

The home page is a page with type: home. The theme renders its hero and features frontmatter first, then the markdown content of the page, then the site footer.

---
type: home
hero:
  name: Theme Default
  text: The default theme of VuePress
  tagline: A thin layout layer ported from VitePress
  image:
    src: /logo.svg
    alt: Theme Default
  actions:
    - theme: brand
      text: Get Started
      link: /guide/
    - theme: alt
      text: GitHub
      link: https://github.com/vuepress
features:
  - title: VitePress-like layout
    details: Navbar, sidebar, outline, home page and footer, with the same CSS variables.
  - title: Plugin-driven
    details: Every non-layout feature is delegated to an ecosystem plugin.
footer: false
---

The classic home frontmatter is still supported. home: true is deprecated: use type: home instead, and the theme logs a warning when this key is set. The flat fields below keep their classic names and are used when hero is not set:

homeDeprecatedboolean

Whether the page is a home page. Deprecated: use type: home instead. The theme logs a warning when this key is set.

heroTextstring | null

The name of the project. It defaults to the site title; set it to null to hide the name.

taglinestring | null

The text of the hero. It defaults to the site description; set it to null to hide the text.

heroImagestring

The hero image. It is used as the source of hero.image.

heroImageDarkstring

The dark variant of the hero image.

heroAltstring

The alternative text of the hero image.

actionsThemeHeroAction[]

The buttons of the hero. The classic type: 'primary' | 'secondary' is supported; theme: 'brand' | 'alt' is also accepted.

Hero

hero.namestring

The name of the project, rendered as the largest line of the hero.

hero.textstring

The main title of the hero, rendered below the name.

hero.taglinestring

The tagline of the hero, rendered below the text.

hero.imageDefaultTheme.ThemeableImage

The hero image. It accepts the same shapes as the logo: a URL string, { src, alt }, or { light, dark, alt } for a color-mode-aware image. The image is rendered in a decorative box and is hidden on small screens.

hero.actionsThemeHeroAction[]

The buttons of the hero. Each action has the fields below.

hero.actions[*].textRequiredstring

The text of the button.

hero.actions[*].linkRequiredstring

The link of the button.

hero.actions[*].theme'brand' | 'alt'
Default'brand'

The style of the button: brand for the filled primary button, alt for the secondary button.

hero.actions[*].targetstring

The target attribute of the link.

hero.actions[*].relstring

The rel attribute of the link.

Features

featuresThemeFeature[]

The feature cards shown below the hero.

features[*].iconDefaultTheme.FeatureIcon

The icon of the card. It accepts:

  • an Iconify name, such as 'mdi:github' — the name must contain a colon, and it is rendered by @vuepress/plugin-icon.
  • a string of emoji or inline SVG markup, which is rendered as HTML.
  • an image: { src, alt? } or { light, dark, alt? } — the same themed image shapes as the logo, with optional width and height in pixels (both default to 48).
  • an image wrapped in a decorative box: add wrap: true to an image object.
features[*].titleRequiredstring

The title of the card. HTML is allowed.

features[*].detailsRequiredstring

The description of the card. HTML is allowed.

features[*].linkstring

The link of the whole card.

features[*].linkTextstring

When link is set, the text shown at the bottom of the card next to an arrow. The card is clickable even without it.

features[*].targetstring

The target attribute of the card link.

features[*].relstring

The rel attribute of the card link.

Home Content

The markdown content of the home page is rendered below the features, inside the themed document styles. Write it exactly like the content of a document page, but note that the outline and the document footer are not rendered on a home page.

Set markdownStyles: false in the frontmatter to render the content without the document styles, for example when the whole section is a custom component:

---
type: home
markdownStyles: false
---

<MyLandingPage />

Team and Sponsors

Team and sponsor sections have no frontmatter fields: they are composed with the exported components inside the home content. Wrap them in VPHomeContent when they should stretch to the full viewport width:

---
type: home
---

<VPHomeContent>

## Our Team

<VPTeamPage>
  <VPTeamPageTitle>
    <template #title>Our Team</template>
    <template #lead>The people behind the project.</template>
  </VPTeamPageTitle>
  <VPTeamPageSection>
    <template #title>Core Team</template>
    <template #members>
      <VPTeamMembers :members="members" />
    </template>
  </VPTeamPageSection>
</VPTeamPage>

</VPHomeContent>

<script setup>
import { VPHomeContent, VPTeamPage, VPTeamPageSection, VPTeamPageTitle, VPTeamMembers } from '@vuepress/theme-default/client'

const members = [
  {
    avatar: 'https://github.com/vuepress.png',
    name: 'VuePress',
    title: 'Maintainer',
    links: [{ icon: 'github', link: 'https://github.com/vuepress' }],
  },
]
</script>

The complete prop list of the components is in Built-in Components.

footerboolean | string
Defaulttrue

Whether to render the site footer on this page, or the footer text of the page. A string renders that text as the page footer instead of the site footer.

footerHtmlboolean
Defaultfalse

Whether to render a string footer as HTML.

Document Page

A document page is a page without a type field, or with type: doc. It renders the document shell: the article, the outline aside, and the document footer with the edit link, the last updated time, the contributors and the previous/next links.

The following fields override the theme options for one page:

outlineDefaultTheme.Outline | DefaultTheme.Outline['level'] | false

The heading levels of the outline. See outline.

asideboolean | 'left'

Whether to render the aside, or to render it on the left. See aside.

editLinkboolean

Whether to render the edit link on this page. It does not change the link target.

lastUpdatedboolean | number

Whether to show the last updated time on this page. A number is used as the timestamp in milliseconds, which is useful when the git history is not available:

---
lastUpdated: 1700000000000
---
contributorsboolean

Whether to show the contributors on this page.

prevstring | { text?: string; link?: string; rel?: string; target?: string } | false

The previous page link of this page. A string is used as the link text. Set it to false to hide the link.

nextstring | { text?: string; link?: string; rel?: string; target?: string } | false

The next page link of this page, with the same shapes as prev.

sidebarDefaultTheme.Sidebar | 'heading' | false

The sidebar configuration of this page. See sidebar.

sidebarDepthnumber

The maximum heading depth of the 'heading' sidebar of this page.

By default the previous/next links are the neighbours of the page in the sidebar. The link text falls back to the docFooterText of the sidebar item, then to the item text.

The fields in this section are used when the sidebar is generated from the file structure, i.e. when sidebar is 'structure', '/path/': 'structure' or { items: 'structure' }. They have no effect on a sidebar that is configured manually.

indexboolean

Set it to false to hide the page from the generated sidebar.

ordernumber

The position of the item among its siblings. A positive value puts the page before the pages without an order, a negative value puts it after them.

shortTitlestring

The text of the item, it takes precedence over the page title.

iconstring

The icon of the item, in the same form as sidebar[*].icon.

dirSidebarDirOptions

The options of the group that represents the directory of this page. It is only read from the README.md of the directory, the field of the other pages is ignored.

The options are documented in theme-helper: text, icon, collapsible, expanded, link, index and order.

404 Page

The theme registers a NotFound layout. VuePress generates the 404.html page with that layout, so the page shows the theme's not-found screen: an error code, a title, a quote and a link home.

The texts are configured with the notFound theme option, which is usually translated per language in locales. A page also counts as not found when its frontmatter sets layout: NotFound.

All Pages

navbarboolean

Whether to show the navbar on this page. Set it to false for a page that should render without the navbar.

pageClassstring

An extra class added to the theme container of this page, which is useful to scope custom styles:

.vp-theme-container.my-page {
  /* page styles */
}

See Styles for the style file.

markdownStylesboolean

Whether to wrap the home page content in the document styles. It only applies to a home page.

Frontmatter Reference

FieldTypePage typeSee also
type'home' | 'doc' | 'page' | 'content'allPage Type
layoutstringallExtending
navbarbooleanallAll Pages
pageClassstringallAll Pages
markdownStylesbooleanhomeAll Pages
heroThemeHerohomeHero
homebooleanhomeHome Page
heroTextstring | nullhomeHome Page
taglinestring | nullhomeHome Page
heroImagestringhomeHome Page
heroImageDarkstringhomeHome Page
heroAltstringhomeHome Page
actionsThemeHeroAction[]homeHome Page
featuresThemeFeature[]homeFeatures
footerboolean | stringallHome Footer
footerHtmlbooleanallHome Footer
outlineDefaultTheme.Outline | number | [number, number] | falsedocDocument Page
asideboolean | 'left'docDocument Page
editLinkbooleandocDocument Page
lastUpdatedboolean | numberdocDocument Page
contributorsbooleandocDocument Page
prevstring | ThemePageLink | falsedocDocument Page
nextstring | ThemePageLink | falsedocDocument Page
sidebarDefaultTheme.Sidebar | 'heading' | falsedocDocument Page
sidebarDepthnumberdocDocument Page
indexbooleandocSidebar Structure
ordernumberdocSidebar Structure
shortTitlestringdocSidebar Structure
iconstringdocSidebar Structure
dirSidebarDirOptionsdocSidebar Structure

MIT Licensed