string
docs
Specifies the document root directory. For example:
This config supports both relative and absolute paths, with relative paths being relative to the current working directory(cwd).
Of course, in addition to specifying the document root directory through the config file, you can also specify it through command line parameters, such as:
string
/
Deployment base path. For example, if you plan to deploy your site to https://foo.github.io/bar/
, then you should set base
to "/bar/"
:
string
"Rspress"
Site title. This parameter will be used as the title of the HTML page. For example:
string
""
Site description. This will be used as the description of the HTML page. For example:
string
""
Site icon. This path will be used as the icon path for the HTML page. For example:
The framework will find your icon in the public
directory, of course you can also set it to a CDN address.
string
""
Default language of the site. See Internationalization for more details.
string | { dark: string; light: string }
""
Site logo. This path will be used as the logo path in the upper left corner of the navbar. For example:
The framework will find your icon in the public
directory, you can also set it to a CDN address.
Of course you can set different logos for dark/light mode:
string
""
Site logo Text. This text will be used as the logo text in the upper left corner of the navbar. For example:
string
doc_build
Custom output directory for built sites. for example:
Locale[]
I18n config of the site. for example:
string
| [string, Record<string, string>]
| (route) => string | [string, Record<string, string>] | undefined
Used to set additional elements rendered in the <head>
tag of the page's HTML in production mode.
boolean
| { selector?: string }
true
Whether to enable the image zoom function. It is enabled by default, you can disable it by setting mediumZoom
to false
.
The bottom layer is implemented using the medium-zoom library.
Example usage:
{ searchHooks: string; versioned: boolean; }
You can add search runtime hooks logic through the searchHooks
parameter, for example:
For specific hook logic, you can read Customize Search Functions.
If you are using multiVersion
, the versioned
parameter allows you to create a separate search index for each version of your documentation.
When enabled, the search will only query the index corresponding to the currently selected version.
(string | [string, object])[]
[]
You can register global UI components through the globalUIComponents
parameter, for example:
The item of globalUIComponents
can be a string, which is the path of the component file, or an array, the first item is the path of the component file, and the second item is the component props, for example:
When you register global components, the framework will automatically render these React components in the theme without manually importing and using them.
Through global components, you can complete many custom functions, such as:
In this way, the content of the component will be rendered in the theme page, such as adding BackToTop button.
In the meanwhile, you can also use the global component to register some side effects, such as:
This way, side effects of components are executed in the theme page. For example, some of the following scenarios require side effects:
Redirect for certain page routes.
Bind click event on the img tag of the page to implement the image zoom function.
When the route changes, the PV data of different pages are reported.
......
{ default: string; versions: string[] }
You can enable multi-version support through the multiVersion
parameter, for example:
The default
parameter is the default version, and the versions
parameter is the version list.
Object
Custom route config.
string[]
[]
Add some extra files in the route. By default, only the files in the document root directory will be included in the route. If you want to add some extra files to the route, you can use this option. For example:
Note: The strings in the array support glob patterns, the glob expression should be based on the
root
directory of the document, with the corresponding extensions suffix.
We recommend using addPages hook in a custom Rspress plugin to add some additional files to the route, so that the page route and file path/content can be specified more flexibly and reasonably.
string[]
[]
Exclude some files from the route. For example:
Note: The strings in the array support glob patterns, the glob expression should be based on the
root
directory of the document.
string[]
[]
The extensions of the files that will be included in the route. By default, Rspress will include all 'js'
, 'jsx'
, 'ts'
, 'tsx'
, 'md'
, 'mdx'
files in the route. If you want to customize the extensions, you can use this option. For example:
Boolean
false
Generate url without suffix when cleanUrls
is true
for shorter url link.
boolean | { strict?: boolean }
true
Determines whether to enable Static Site Generation. It is enabled by default, but you can disable it by setting ssg
to false
.
If SSG fails, it will fallback to CSR by default. You can set ssg
to { strict: true }
to strictly require SSG to succeed, otherwise an error will be thrown.
{ search: string | RegExp; replace: string; }[]
[]
You can set text replacement rules for the entire site through replaceRules
. The rules will apply to everything including _meta.json
files, frontmatter configurations, and document content and titles.