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
The page title. By default, Rspress uses the page's H1 heading as the HTML document title. To use a different title, set it in frontmatter:
It is equivalent to:
description
- Type:
string
A custom description for the page. Rspress uses it to generate a <meta name="description" content="..." /> tag on the page for SEO optimization.
By default, Rspress extracts the first contentful paragraph below the h1 heading as the description (see markdown.extractDescription). If the extracted result does not meet your needs, you can use this field to override it. For more details, see Custom Head - How description is determined.
pageType
- Type:
'home' | 'doc' | 'doc-wide' | 'custom' | 'blank' | '404' - Default:
'doc'
The page type. The default is doc. To use a different page type, set the pageType frontmatter field:
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
Set the suffix of the page title. When titleSuffix is not set, the site's title is used as the suffix by default.
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
Controls whether the right-side outline is shown. By default, doc pages display the right-side outline. 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
Controls whether footer components, such as previous/next page links, are shown at the bottom of the page. By default, doc pages display the footer. To hide it, use:
navbar
Controls whether the top navbar is shown. By default, all pages display the top navbar. To hide it, use:
context
- Type:
string
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>][]
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:
Object
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:
Array - 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: