CloudCannons Pagefind is a fast search library for self-hosting indices and a search interface. Especially @bwintx wrote about it here and on his blog.
Pagefind has its own local server that delivers a build including its library for testing purposes. But when you are working on your Hugo templates, you may prefer to use the local Hugo server as usual.
And that’s easy to accomplish: Run something like
npx pagefind --source="public" --bundle-dir="static/_pagefind" on your local build directory.
The goal is to put the pagefind library not in
public as needed for up-to-date indices in production, but in the
static folder of the local project.
The next run of
hugo server will include this
_pagefind folder and that`s it. If you change your content and want it to show in the local search results you need to run pagefind again.