· One min read
Search is essential for documentation. But most search solutions require an external service.
Pagefind doesn't. It indexes your site at build time and serves search from static files.
Why Pagefind?
| Feature | Algolia | Pagefind |
|---|---|---|
| Cost | Free (with approval) | Free |
| Setup | Manual application | One command |
| Privacy | Third-party | Self-hosted |
| Speed | Fast | Fast |
| Offline | No | Yes |
Pagefind wins on privacy and simplicity.
Step 1 — Install
npm install docusaurus-plugin-pagefind
Step 2 — Configure
In docusaurus.config.ts:
plugins: [
[
'docusaurus-plugin-pagefind',
{
forceLanguage: 'en',
excludeSelectors: ['.navbar', 'footer'],
},
],
],
Step 3 — Build
npm run build
Pagefind indexes your site during the build.
Step 4 — Test
Search works only after a production build. Run:
npm run serve
Then test search in your browser.
Nocturne Includes Pagefind
Nocturne ships with Pagefind pre-configured. No setup required.