Any Markdown file that contains a YAML frontmatter block will be processed by gray-matter. The frontmatter must be the first thing in the Markdown file and must take the form of valid YAML set between triple-dashed lines. Here is a basic example:
---
title: Blogging Like a Hacker
lang: en-US
---
Between these triple-dashed lines, you can set predefined variables (see below for a reference), or even create custom ones of your own. These variables will then be available to you to access using $frontmatter
at the rest of the page, plus all custom and theming components.
::: tip frontmatter variables are optional in VuePress. :::
VuePress also supports JSON or TOML frontmatter.
JSON frontmatter needs to start and end in curly braces:
---
{
"title": "Blogging Like a Hacker",
"lang": "en-US"
}
---
TOML frontmatter needs to be explicitly marked as TOML:
---toml
title = "Blogging Like a Hacker"
lang = "en-US"
---
- Type:
string
- Default:
h1_title || siteConfig.title
Title of current page.
- Type:
string
- Default:
en-US
Language of current page.
- Type:
string
- Default:
siteConfig.description
Description of current page.
- Type:
string
- Default:
Layout
Set the layout component of the current page.
- Type:
string
- Default:
siteConfig.permalink
Refer to: Permalinks.
- Type:
string
- Default:
`${page.title} | ${siteConfig.title}`
Override the default meta title.
- Type:
array
- Default:
undefined
Specify extra meta tags to be injected:
---
meta:
- name: description
content: hello
- name: keywords
content: super duper SEO
---
- Type:
boolean
- Default:
undefined
See: Default Theme Config > Disable the Navbar.
- Type:
boolean|'auto'
- Default:
undefined
See: Default Theme Config > Sidebar.
- Type:
boolean|string
- Default:
undefined
See: Default Theme Config > Prev / Next Links.
- Type:
boolean|string
- Default:
undefined
See: Default Theme Config > Prev / Next Links.
- Type:
boolean
- Default:
undefined
See: Default Theme Config > Built-in Search.
- Type:
array
- Default:
undefined