Add AI Search to your Docusaurus docs
What is Docusaurus
Docusaurus is an open-source documentation platform powered by MDX and React.
Get an API key
- Go to the Inkeep Dashboard
- Select your project under Projects
- Go to the Integrations tab
- Click on Create integration
- Select Web
- Provide a Name and URL (optional) for the integration
- Click on Create
- Click the Example < /> button to get your API key and view suggested settings
Install the Inkeep plugin
Define the widget
Аdd the search bar as a theme in your docusaurus.config.js
file:
If you are already using Algolia DocSearch
provided by Docusaurus by default, it will be replaced by our widget.
Сonfiguration settings
Next, add the below to the themeConfig
property:
For a full list of customizations, check out the Common Settings.
If you have already created a custom SearchBar
component (for example via swizzle eject
) this will need to be removed in order to use our Search Bar.
We support docusaurus versions 2.0.1
and above.
To load a custom stylesheet for the widgets, start by creating a stylesheet within the static
directory. For instance, you might name this file inkeep-overrides.css
. You'll then need to specify the URL of the stylesheet in the stylesheetUrls
prop of inkeepConfig
(inside of baseSettings
-> theme
).
As an example, if your site is configured with baseUrl: '/'
, and you have the CSS file located at /static/inkeep-overrides.css
, you should set the stylesheetUrls
to ['/inkeep-overrides.css']
.
For additional details on how Docusaurus manages static assets, please refer to the official documentation.
If you need more control or customizations, you can use the React components directly. To do so, follow the react guides: chat button, search bar, embedded chat, custom trigger.
A few things to keep in mind:
- If using Docusaurus 3.4.0 you will need to load the inkeep widget component dynamically and wrap it in a
<BrowserOnly>
tag. For example:
- If using the ChatButton component, you can create a
Footer.js
in thethemes
directory then import the original Footer component and add the Chat Button so that it will be present on each page. For example: