Skip to content

Connect to Docusaurus

Installation

You can install the plugin using any major Node.js package manager.

Terminal window
npm install @orama/plugin-docusaurus-v3

Usage

To use the plugin you will need to add it to your Docusaurus list of plugins. You can do this by adding the following code to your docusaurus.config.js file:

docusaurus.config.js
plugins: [
[
"@orama/plugin-docusaurus-v3",
{
cloud: {
apiKey: process.env.ORAMA_CLOUD_PRIVATE_API_KEY,
indexId: "YOUR_ORAMA_CLOUD_INDEX_ID",
deploy: process.env.ENABLE_ORAMA_CLOUD_DEPLOY,
},
},
],
];

Configuration

You can get the variables required for the plugin’s configuration in your Orama Cloud dashboard, right after creating a new index.

NameRequiredTypeDescription
indexIdyesstringThe ID of the index you want to connect to.
apiKeyyesstringYour Private API key. Keep it safe!
deploynodefault, snapshot-only, undefineddefault Deploys the index while building/starting your project.
snapshot-only Inserts the data into the index but does not deploy it.
undefined Does not deploy the index.

Creating an index

  1. Go to a project in your dashboard, and click on “Add index” and then “Native Integrations”.

    Then, click on the Docusaurus logo to create a new index.

  2. As soon as you click on “Create index”, Orama Cloud will give you all the variables you need to set up the plugin.

    Docusaurus variables shown on Orama Cloud
  3. Now you can set up the plugin on your Docusaurus project.

    Please refer to the Usage section above for the plugin configuration.

    Once you configured your docusaurus.config.js file, Orama will update the index with the data from your Docusaurus project at build time.

    The plugin will also automatically install the Orama searchbox on your documentation, so there’s no need to add it manually!

  4. Congrats! 🎉 You just connected your Docusaurus project to Orama Cloud.

Advanced configuration

Searchbox & Search Button

This plugin uses the Orama Searchbox for the search functionality. You pass props to the searchbox and/or the search button component by adding the following code to your docusaurus.config.js file:

docusaurus.config.js
plugins: [
[
"@orama/plugin-docusaurus-v3",
{
cloud: {
apiKey: process.env.ORAMA_CLOUD_PRIVATE_API_KEY,
indexId: "YOUR_ORAMA_CLOUD_INDEX_ID",
deploy: "default"
},
searchbox: {
placeholder: "Search...",
}
searchButton: {
text: "Click here to search..."
}
},
],
];

For more information about the props you can use on the searchbox, check the Searchbox section and the Search Button section.