@karaoke-cms/module-search
v0.18.1
Published
Pagefind search module for karaoke-cms
Maintainers
Readme
@karaoke-cms/module-search
Pagefind search module for karaoke-cms — full-text search at /search, powered by Pagefind. Add it once; the search index is generated automatically at build time.
Installation
npm install @karaoke-cms/module-searchUsage
// karaoke.config.ts
import { defineConfig } from '@karaoke-cms/astro';
import { search } from '@karaoke-cms/module-search';
export default defineConfig({
// ...
modules: [search()],
});No options required. The module injects a /search page and runs the Pagefind indexer automatically after npm run build.
How it works
- You add
search()tomodules[]. - On
npm run build, the module runsnpx pagefind --site dist/as a post-build hook — no CI changes needed. - The
/searchpage renders the Pagefind widget, which loads the pre-built index client-side.
Dev mode
After running npm run build at least once, the search index in dist/pagefind/ is automatically served at /pagefind/ during npm run dev via a Vite middleware. Search works in dev without restarting the dev server — just build once to generate the index, then use dev as normal.
Routes
| Pattern | Description |
|---------|-------------|
| /search | Search UI page — Pagefind widget |
Default CSS
The module ships default styles for the search page. On first dev run, src/styles/search.css is copied to your project and imported automatically. You can edit this file to customise the layout.
What's new in 0.17.0
- Search works in dev mode — after running
npm run buildonce,dist/pagefind/is served at/pagefind/by a Vite dev middleware. No dev server restart needed; search results appear immediately innpm run dev.
What's new in 0.13.1
No user-facing changes in this release.
What's new in 0.13.0
- Initial release —
/searchpage with Pagefind widget; Pagefind index generated automatically atastro:build:done; default CSS shipped with the module
