Frontmatter config
This page explains how to configure page-level properties with frontmatter, including title, description, page type, and navbar visibility.
See Frontmatter for the frontmatter syntax, and useFrontmatter for accessing frontmatter in code.
title
- Type:
string - Default: The page's H1 heading
Overrides the page title:
It is equivalent to:
description
- Type:
string - Default: The first contentful paragraph below the H1 heading when
markdown.extractDescriptionis enabled
A custom description for the page. Rspress uses it to generate a <meta name="description" content="..." /> tag on the page for SEO optimization.
For details on how Rspress chooses a description, see Custom Head - How description is determined.
pageType
- Type:
'home' | 'doc' | 'doc-wide' | 'custom' | 'blank' | '404' - Default:
'doc'
Sets the page layout. For example, to use the homepage layout:
The meaning of each pageType config is as follows:
home: Homepage, including the top navbar and homepage layout content.doc: Doc page, including the top navbar, left sidebar, body content, and right-side outline.doc-wide: Wide doc page, where the main content can occupy a wider area whenoutline: falseandsidebar: falseare used together.custom: Custom page, including the top navbar and custom content.blank: Also a custom page, but without the top navbar.404: Not found page.
titleSuffix
- Type:
string - Default: The site's
title
Sets the suffix of the page title.
The default separator between the title and suffix is -. You can also use |:
sidebar
- Type:
boolean | 'placeholder' - Default:
true
Controls whether the left sidebar is shown. By default, doc pages display the left sidebar. To hide it, use the following frontmatter:
sidebar: false hides the sidebar and keeps a 12vw placeholder on the left to keep the content visually centered on large screens. If you want the main content to occupy a wider screen space, you can use pageType: doc-wide with sidebar: false:
The main content area will then expand into the space normally used by the sidebar.
If you want to keep the blank space for the left sidebar, use sidebar: 'placeholder':
outline
- Type:
boolean - Default:
true
Controls whether the right-side outline is shown on documentation pages. To hide it, use:
outline: false only hides the outline column, but the space originally occupied by the outline column is still reserved. If you want the main content to occupy a wider screen space, you can use pageType: doc-wide with outline: false:
The main content area will then expand into the space normally used by the outline.
footer
- Type:
boolean - Default:
true
Controls whether documentation pages show the footer, including the previous and next page links. To hide it, use:
navbar
- Type:
boolean - Default:
true
Controls whether the top navbar is shown. To hide it, use:
icon
- Type:
string - Default:
undefined
Sets the icon displayed before the page title in an automatically generated sidebar. For local images, place the asset in the public directory and reference it with an absolute path:
Inline SVG strings, emoji, external URLs, and data URLs are also supported. If the same file item defines icon in both frontmatter and _meta.json, the frontmatter value takes precedence.
See Sidebar icons and tags for more examples.
context
- Type:
string - Default:
undefined
When configured, Rspress adds a data-context attribute with this value to the generated sidebar DOM node.
The DOM structure of the final generated sidebar is abbreviated as follows:
search
- Type:
boolean - Default:
true
Whether to include the current page in the built-in search index. By default every doc page is indexed for full-text search. If you want to exclude a specific page from the search results, set search to false:
This only affects the built-in search. Pages with pageType: home are always excluded from the search index regardless of this field.
head
- Type:
[string, Record<string, string>][] - Default:
undefined(no extra tags)
Specify extra head tags to be injected for the current page. They will be appended after the head tags injected by Rspress globally.
For example, you can use these headers to specify custom meta tags for Open Graph.
The generated head tags are as follows:
Overview page related
The following configurations are related to the Overview Page feature.
overview
- Type:
boolean - Default:
false
Enables the overview page feature for the current doc page. When set to true, the current page becomes an Overview Page. For example:
overviewHeaders
- Type:
number[] - Default:
[2]
Heading levels to show on the overview page. By default, H2 headings are shown. To display other heading levels, set the overviewHeaders frontmatter field:
Or
Homepage related
The following options are related to the homepage feature.
hero
- Type:
Hero - Default:
undefined
Hero configuration for the home page. It has the following type:
For example, use the following frontmatter to specify a page's hero configuration:
When setting hero.text, you can use the | symbol in YAML to manually control line breaks:
You can also use HTML in the page's hero configuration:
features
- Type:
Feature[] - Default:
[]
Feature configuration for the home page. It has the following type:
For example, use the following frontmatter to specify the features for the home page: