β Back to blog
Static-site search with Pagefind
Even a fully static site can have smooth full-text search, with zero backend.
The biggest pain of a static site is search: no server, how do you search? The answer might be Pagefind.
Clever idea
After the build, Pagefind scans the generated HTML, builds an index, and emits static files. When a user searches, the index loads in the browser β no backend at all.
npm run build # astro build && pagefind --site dist
Experience
- Chinese word segmentation works
- Hit words are highlighted in results
- Works out of the box after build; dev mode shows a friendly fallback
For a personal blog, itβs the highest-leverage search option, bar none.