Integrate Pagefind for enhanced search functionality: update build process to include search indexing, add search page and UI components, and modify templates for search integration. Update styles for search modal and ensure proper indexing of chapter content. Enhance documentation to reflect new search capabilities.

This commit is contained in:
Hananoshika Yomaru 2026-05-19 12:29:49 -07:00
parent c66f8850a9
commit 227404f623
23 changed files with 553 additions and 19 deletions

View file

@ -29,12 +29,16 @@ See [reference.md](reference.md) for Tera pitfalls and build checks.
```bash
bun run build:js # Vite → themes/openfreebooks/static/js/ (bundle.js + lazy chunks)
zola build # required before indexing
bun run index:search # pagefind on public/ → copies to static/pagefind/ for zola serve
zola serve # dev at http://127.0.0.1:1111
bun run build # build:js + zola build → public/
bun run build # build:js + zola build + index:search
```
After Sass or template changes, run `zola build` (or `zola serve`). Do **not** copy `public/` into `themes/openfreebooks/static/`.
**Search (Pagefind):** read [zola-pagefind.md](zola-pagefind.md) before changing search UI, indexing, or `data-pagefind-*` attributes.
## Templates (Tera)
- Extend `base.html`; use `{% block content %}` for page bodies.
@ -75,6 +79,11 @@ Client behavior lives in `frontend/` and mounts from `base.html`:
**When changing `frontend/` or adding interactivity**, read [zola-solid.md](zola-solid.md) before editing JS.
### Search (Pagefind)
- Runs after `zola build`; indexes **live chapter pages** only (`data-pagefind-body` on chapter template).
- UI: global modal (⌘K) + `/search/` page. See [zola-pagefind.md](zola-pagefind.md).
### Catalog page
- `content/catalog.md` → `template = "catalog.html"`