Skip to main content

Getting started

Let's discover how to install and configure docusaurus-plugin-search-local

Installation

yarn install docusaurus-plugin-search-local

Configuration

docusaurus.config.js
{
plugins: [
[
require.resolve("docusaurus-plugin-search-local"),
{
...options
},
],
],
}

Options

NameTypeDefaultDescription
indexDocsbooleantrueWhether to index docs.
indexBlogbooleantrueWhether to index blog.
indexPagesbooleanfalseWhether to index pages.
docsRouteBasePathstring | string[]"/docs"Base route path(s) of docs. Slash at beginning is not required.
blogRouteBasePathstring | string[]"/blog"Base route path(s) of blog. Slash at beginning is not required.
languagestring | string[]"en"All lunr-languages supported languages, + zh 🔥.
hashedbooleanfalseWhether to add a hashed query when fetching index (based on the content hash of all indexed *.md in docsDir and blogDir if applicable)
docsDirstring | string[]"docs"The dir(s) of docs to get the content hash, it's relative to the dir of your project.
blogDirstring | string[]"blog"Just like the docsDir but applied to blog.
removeDefaultStopWordFilterbooleanfalseSometimes people (E.g., us) want to keep the English stop words as indexed, since they maybe are relevant in programming docs.
highlightSearchTermsOnTargetPagebooleanfalseHighlight search terms on target page.
searchResultLimitsnumber8Limit the search results.
searchResultContextMaxLengthnumber50Set the max length of characters of each search result to show.
translationsTranslationMap-Set translations of this plugin, see docs below.
ignoreFilesstring | RegExp | (string | RegExp)[]/meta\$/Set the match rules to ignore some files.