Theme config
Theme config is located under themeConfig in the doc param. For example:
nav
- Type:
Array - Default:
[]
The nav configuration is an array of NavItem with the following types:
activeMatch is used to match the current route, when the route matches the activeMatch rule, the nav item will be highlighted. By default, activeMatch is the link of the nav item.
For example:
Of course, multi-level menus can also be configured in the nav array with the following types:
For example the following configuration:
sidebar
- Type:
Object
The sidebar of the website. The config is an object with the following types:
For example:
footer
- Type:
Object - Default:
{}
The footer of the home page.
The footer config is an object of Footer, which has the following types:
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
Whether to display the last updated time of each document page. 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:
[]
You can add related links through the following config, such as github links, x links, etc.
Related links support five modes: link text img dom github-stars, for example:
- When in
linkmode, click the icon to jump to the link. - When in
textmode, when the mouse moves over the icon, a pop-up box will be displayed, and the content of the pop-up box is the entered text - When in the
imgmode, moving the mouse over the icon will display a bullet box, and the content of the bullet box is the specified picture. It should be noted that the picture needs to be placed in thepublicdirectory. - When in dom mode, html to render can be passed directly into the content field. Use '' for wrapping
- 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 types of images, which can be selected through the icon attribute:
If you need to customize the icon, you can pass in an object with svg attribute, and the value of svg is the content of the custom icon, for example:
nextPageText
- Type:
string - Default:
Next Page
Text for the next page. for example:
locales
- Type:
Array<LocaleConfig> - Default:
undefined
I18n config. This config is an array, and every item of it is LocaleConfig, and the types are as follows:
LocaleConfig contains many of the same configuration options as the theme config, but the former will have a 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
Whether there is animation effect when switching between pages. It is implemented with View Transition API. For example:
The animation is not configurable for now.
enableAppearanceAnimation
- Type:
boolean - Default:
false
Whether there is animation effect when switching between light and dark theme. It is implemented with 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
Enable scroll to top button on documentation. For example:
localeRedirect
- Type:
'auto' | 'never' | 'only-default-lang' - Default:
'auto'
Whether to redirect to the locale closest to window.navigator.language when the user visits the site, the default is auto, which means that the user will be redirected on the first visit. If you set it to never, the user will not be redirected. If you set it to only-default-lang, the user will only be redirected when visiting the default locale. For example:
fallbackHeadingTitle
- Type:
boolean - Default:
true
Whether to use frontmatter.title as fallback when the document does not have an H1 heading. For example:
llmsUI
- Type:
- Default:
false(automatically set totruewhenllms: trueis configured)
Configuration for LLMS UI components. When enabled, LlmsCopyButton and LlmsViewOptions components will be automatically added below all H1 headers (default), or as rows in the outline panel.
This is useful when using the llms feature to generate llms.txt files, allowing users to easily copy or open the markdown content in AI tools.
ssg-md only takes effect during the build process, so copying Markdown content in dev mode will not work. Please use rspress build first, then debug with rspress preview. See Differences between dev and build for details.
For example:
viewOptions
- Type:
Array<'markdownLink' | 'chatgpt' | 'claude' | CustomOption> - 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
You can also provide custom options with title, href or onClick, and optional icon.
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