Skip to main content

Install Docsense

Add local documentation search to an existing Docusaurus project.

Before you start​

You need:

  • A Docusaurus site (v3 recommended)
  • Node.js 18 or newer
  • Markdown or MDX docs under a folder such as docs/

Install the plugin​

From your site root:

npm install docusaurus-plugin-docsense

Add the plugin to your config​

In docusaurus.config.js or docusaurus.config.ts:

import docsensePlugin from 'docusaurus-plugin-docsense';

export default {
plugins: [
[
docsensePlugin,
{
docsDirs: ['docs'],
docsRouteBasePath: '/docs',
resultLimit: 8,
searchBar: {
placeholder: 'Search the docs…',
triggerLabel: 'Search docs',
shortcut: 'mod+k',
showShortcutHint: true,
},
},
],
],
};

The plugin registers a SearchBar theme component. Docusaurus picks it up for the navbar search slot.

Start the site​

npm run start

Open the site, then press ⌘K or Ctrl+K, or click Search docs in the navbar.

On start and build, Docsense writes:

static/docsense/search-index.json

Optional: themeConfig overrides​

You can also set labels and the default page limit under themeConfig.docsense:

themeConfig: {
docsense: {
resultLimit: 8,
searchBar: {
placeholder: 'Find guides and references…',
triggerLabel: 'Search docs',
},
},
},

Next steps​