Theme config
Theme configuration is defined under themeConfig. For example:
nav
- Type:
Array - Default:
[]
The nav configuration is an array of NavItem with the following types:
activeMatch matches the current route. When the route matches the activeMatch rule, the nav item is highlighted. By default, activeMatch uses the nav item's link.
For example:
You can also configure multi-level menus in the nav array with the following type:
For example:
sidebar
- Type:
Object
Site sidebar configuration. It is an object with the following type:
For example:
footer
- Type:
Object - Default:
{}
Homepage footer configuration.
The footer config is a Footer object:
message is a string that can contain HTML content. This string will be inserted into the footer using dangerouslySetInnerHTML, allowing you to pass in HTML template tags to design your footer.
For example:
lastUpdated
- Type:
boolean | { author?: boolean | ((info: { name: string; email: string; filePath: string }) => string) } - Default:
false
Controls whether each doc page shows its last updated time. Rspress reads this value from the file's latest Git commit.
When deploying in CI, make sure the Git history is available. For example, use fetch-depth: 0 with actions/checkout on GitHub Actions.
Set author to display the last commit author as well. Pass a function to customize the rendered author text.
socialLinks
- Type:
Array - Default:
[]
Add related links, such as GitHub or X links. Related links support five modes: link, text, img, dom, and github-stars. For example:
- In
linkmode, clicking the icon opens the link. - In
textmode, hovering over the icon displays a tooltip with the configured text. - In
imgmode, hovering over the icon displays a tooltip with the configured image. The image must be placed in thepublicdirectory. - In
dommode, pass the HTML string to render directly tocontent. Wrap it in quotes. - When in
github-starsmode,contentshould be the GitHub repository URL. The repository's star count is fetched from the GitHub REST API and rendered next to the icon. The result is cached inlocalStoragefor one hour to avoid hitting the API rate limit. If the request fails (offline, rate-limited, private repo), the icon falls back to a plain link.
Related links support the following icons via the icon field:
To use a custom icon, pass an object with an svg field. The svg value is the custom icon content:
nextPageText
- Type:
string - Default:
Next Page
Text for the next page link. For example:
locales
- Type:
Array<LocaleConfig> - Default:
undefined
I18n configuration. This is an array of LocaleConfig objects:
LocaleConfig contains many of the same options as the theme config, but locale-specific values have higher priority.
darkMode
- Type:
boolean | 'dark' | 'light' | 'auto' | 'force-light' | 'force-dark' | 'force-auto' - Default:
true
When dark mode is active, Rspress adds the dark class to the <html> element. You can use the html.dark selector to customize dark mode styles:
Configure the Dark/Light mode behavior:
true: same as'auto'.false: same as'force-light'.'light': show the toggle button and use light mode by default when the user has no saved preference.'dark': show the toggle button and use dark mode by default when the user has no saved preference.'auto': show the toggle button and follow the user's system preference by default when the user has no saved preference.'force-light': always use light mode and hide the toggle button.'force-dark': always use dark mode and hide the toggle button.'force-auto': always follow the user's system preference and hide the toggle button.
For example, always use dark mode and hide the toggle button:
editLink
- Type:
- Default:
undefined
Display a link to edit the page on Git management services such as GitHub, or GitLab. The link appears in both the doc footer and the right-side outline panel.
For example:
enableContentAnimation
- Type:
boolean - Default:
false
Controls whether page transitions are animated. This is implemented with the View Transition API. For example:
The animation is not configurable for now.
enableAppearanceAnimation
- Type:
boolean - Default:
false
Controls whether switching between light and dark mode is animated. This is implemented with the View Transition API. For example:
The animation is not configurable for now.
search
- Type:
boolean - Default:
true
Whether to display the search box. For example:
enableScrollToTop
- Type:
boolean - Default:
true
Enables the scroll-to-top button in docs pages. For example:
localeRedirect
- Type:
'auto' | 'never' | 'only-default-lang' - Default:
'auto'
Controls whether users are redirected to the locale closest to window.navigator.language. The default is auto, which redirects on the first visit. Set it to never to disable redirects, or only-default-lang to redirect only when the user visits the default locale. For example:
fallbackHeadingTitle
- Type:
boolean - Default:
true
Controls whether frontmatter.title is used as a fallback when a document has no H1 heading. For example:
llmsUI
- Type:
- Default:
false(automatically set totruewhenllms: trueis configured)
Configuration for the llms UI components. When enabled, LlmsCopyButton and LlmsViewOptions are automatically added below all H1 headings by default, or as rows in the outline panel.
This is useful when using the llms feature to generate llms.txt files, because users can copy or open Markdown content in AI tools.
SSG-MD only runs during builds, so copying Markdown content does not work in dev mode. Run rspress build first, then debug with rspress preview. See Differences between dev and build for details.
For example:
viewOptions
- Type:
false | Array<'markdownLink' | 'chatgpt' | 'claude'> - Default:
['markdownLink', 'chatgpt', 'claude']
Options for the LlmsViewOptions dropdown menu. Built-in options include:
'markdownLink': Copy markdown file link'chatgpt': Open in ChatGPT'claude': Open in Claude
Set viewOptions to false or [] to hide the view options UI.
placement
- Type:
'title' | 'outline' - Default:
'title'
Controls where the LLMS UI components are displayed.
'title': Show as buttons below the H1 title (default behavior)'outline': Show as separate rows in the right-side outline panel