docusurus-lunr-search
Offline Search for Docusurus V2
How to Use ?
- Install this package
npm i docusurus-lunr-search --save
- Then run docusurus swizzle
npm run swizzle docusurus-lunr-search SearchBar
- Copy the
build-search-data.js
to the root folder of your project - Then build your Docusurus project
npm run build
- Create the search data using by running
build-search-data.js
node build-search-data.js
- You are done!.
Now you can build your project again with new search-data.js
npm run build
//or
npm start
Sample
Thanks to algolia/docsearch.js
, I modified it to create this search component