Commit 9e477fb
committed
Replace Sphinx search with Pagefind
Sphinx's stock client-side search stems and splits identifiers like
`system.nix` into ubiquitous terms (`system` + `nix`) and stores no
positional data, so phrase/identifier ranking is impossible: searching
`system.nix` did not rank `guides/recipes/dependency-management.html`,
which contains the exact string.
Pagefind indexes the rendered HTML post-build and does real
phrase/proximity ranking. Searching `system.nix` now ranks that page
first.
- `pagefind.yml`: scope indexing to the article body, exclude UI chrome.
- `default.nix`: add `pkgs.pagefind` to `nativeBuildInputs` (also exposes
it in the dev shell via `inputsFrom`).
- `Makefile`: run `pagefind --site build/html` after `sphinx-build` in the
`html` target for local/CI parity, guarded with a clear error if the
binary is missing.
- `source/_templates/search.html`: replace the Sphinx search page with a
Pagefind UI, dropping the now-unused Sphinx search scripts and
pre-filling from `?q=` so the sidebar search box still works.
Assisted-by: Claude:claude-opus-4-81 parent e23fc1a commit 9e477fb
4 files changed
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments