Based on docsearch, this plugin replaces Rspress's built-in search with algolia.
First, add the following configuration to your config file:
Then override the Search
component with an algolia-supported search box via Custom Theme.
The plugin accepts an options object with the following type:
string | undefined
undefined
Used for meta tag verification when creating algolia crawler. Format: <meta name="algolia-site-verification" content="YOUR_VERIFICATION_CONTENT" />
. Refer to Create a new crawler - algolia
The SearchProps
type from @rspress/plugin-algolia/runtime
is as follows:
import('@docsearch/react').DocSearchProps
undefined
docSearchProps
will be directly passed to the <DocSearch />
component in @docsearch/react
. For specific types, please refer to docsearch documentation.
{}
For customizing translated text in different languages, Rspress provides the following translated text, which can be imported through import.
Rspress provides Chinese translation by default, and you can customize translated text in different languages through locales
.
Here is an example config based on what this site uses:
You can achieve internationalized search results by combining Runtime API with docSearchProps
.
Here's an example using docSearchProps.searchParameters
: