|
| 1 | +# Pagefind Viability For doesitarm |
| 2 | + |
| 3 | +Date: 2026-03-15 |
| 4 | + |
| 5 | +## Scope |
| 6 | + |
| 7 | +Investigate whether Pagefind is a good replacement for Stork in `doesitarm`, |
| 8 | +given the current Astro 2 + Netlify server build and the existing custom search |
| 9 | +pipeline. |
| 10 | + |
| 11 | +## Short Answer |
| 12 | + |
| 13 | +Pagefind is viable for this repo, but not as a drop-in replacement. |
| 14 | + |
| 15 | +The lowest-risk production path today is to keep the Stork fix and ship it. |
| 16 | +If `doesitarm` later moves to Pagefind, the right migration path is a |
| 17 | +behind-feature-flag prototype using Pagefind's Node API with |
| 18 | +`addCustomRecord()`, not a simple `pagefind --site dist` crawl. |
| 19 | + |
| 20 | +## What The Evidence Says |
| 21 | + |
| 22 | +- Current repo shape: |
| 23 | + `doesitarm` builds with `output: "server"` in Astro and only prerenders a |
| 24 | + small subset of routes (`/`, `/categories`, `/games`). Most searchable |
| 25 | + listing pages are SSR routes, not static HTML files in `dist/`. |
| 26 | +- Current Stork shape: |
| 27 | + [helpers/stork/toml.js](/Users/athena/Code/doesitarm/helpers/stork/toml.js) |
| 28 | + generates a structured index from sitemap payloads, and |
| 29 | + [components/search-stork.vue](/Users/athena/Code/doesitarm/components/search-stork.vue) |
| 30 | + renders a custom search UI over those records. |
| 31 | +- Pagefind official docs: |
| 32 | + the Node API supports `addDirectory()`, `addHTMLFile()`, and |
| 33 | + `addCustomRecord()`. The docs explicitly describe `addCustomRecord()` as a |
| 34 | + way to build an index from non-HTML content. |
| 35 | +- Pagefind browser API: |
| 36 | + supports custom JS search UIs, per-result lazy loading with `result.data()`, |
| 37 | + excerpts, filters, and sorting. |
| 38 | +- Pagefind latest release: |
| 39 | + `v1.4.0`, published 2025-09-01. |
| 40 | +- Relevant GitHub issues: |
| 41 | + `#163` shows Astro + Netlify usage is workable but can need selector/root |
| 42 | + troubleshooting. |
| 43 | + `#198` and `#277` show demand for indexing non-HTML/custom data, which is now |
| 44 | + covered by the Node API docs. |
| 45 | + `#574` remains open for an `npx` wrapper failure on `ubuntu-latest`, which is |
| 46 | + a reason to prefer a pinned dependency and explicit integration over a casual |
| 47 | + CLI-only swap. |
| 48 | + |
| 49 | +## What Works |
| 50 | + |
| 51 | +- Pagefind can support this repo's filters and sorts. |
| 52 | +- Pagefind can support a custom UI instead of the stock widget. |
| 53 | +- Pagefind can index structured records directly with `addCustomRecord()`, |
| 54 | + which matches `doesitarm` better than crawling built HTML. |
| 55 | +- A feature-flagged migration is feasible: |
| 56 | + 1. build Pagefind assets from the existing sitemap payload data |
| 57 | + 2. expose them under `/pagefind/` |
| 58 | + 3. add a Pagefind-backed client alongside the existing Stork component |
| 59 | + 4. switch between them with a runtime/build flag |
| 60 | + |
| 61 | +## What To Avoid |
| 62 | + |
| 63 | +- Do not treat Pagefind as a trivial `postbuild` swap in this repo. |
| 64 | + A plain HTML crawl would miss most of the real searchable surface because the |
| 65 | + site is primarily SSR on Netlify. |
| 66 | +- Do not attempt the production migration by replacing Stork first and figuring |
| 67 | + out the UI later. |
| 68 | +- Do not rely on `npx pagefind` alone in CI without pinning and testing the |
| 69 | + binary/package path on the target image. |
| 70 | + |
| 71 | +## Recommendation |
| 72 | + |
| 73 | +For production now: |
| 74 | + |
| 75 | +1. Ship the Stork Ubuntu 24 fix. |
| 76 | +2. Merge that branch to `master`. |
| 77 | +3. verify the Netlify deploy is green. |
| 78 | + |
| 79 | +For a Pagefind migration later: |
| 80 | + |
| 81 | +1. Add `pagefind` as a pinned dependency. |
| 82 | +2. Create a build script that maps the same sitemap payloads into |
| 83 | + `addCustomRecord()` calls. |
| 84 | +3. Write Pagefind output to `static/pagefind/` or `dist/pagefind/`. |
| 85 | +4. Add a feature flag that swaps the current Stork client for a Pagefind |
| 86 | + adapter in the search UI. |
| 87 | +5. Only remove Stork after the Pagefind path has parity on excerpts, filters, |
| 88 | + and result URLs. |
| 89 | + |
| 90 | +Inference: |
| 91 | +Pagefind is probably the cleaner long-term search engine here, but because this |
| 92 | +repo already has a data-first indexing pipeline, the migration cost is more |
| 93 | +about adapter work than about search quality. |
| 94 | + |
| 95 | +## Source Links |
| 96 | + |
| 97 | +- Pagefind repo: |
| 98 | + https://github.com/Pagefind/pagefind |
| 99 | +- Pagefind latest release: |
| 100 | + https://github.com/Pagefind/pagefind/releases/tag/v1.4.0 |
| 101 | +- Pagefind Node API docs: |
| 102 | + https://pagefind.app/docs/node-api/ |
| 103 | +- Pagefind browser API docs: |
| 104 | + https://pagefind.app/docs/api/ |
| 105 | +- Pagefind filtering docs: |
| 106 | + https://pagefind.app/docs/filtering/ |
| 107 | +- Pagefind sorts docs: |
| 108 | + https://pagefind.app/docs/sorts/ |
| 109 | +- Pagefind issue `#163`: |
| 110 | + https://github.com/Pagefind/pagefind/issues/163 |
| 111 | +- Pagefind issue `#198`: |
| 112 | + https://github.com/Pagefind/pagefind/issues/198 |
| 113 | +- Pagefind issue `#277`: |
| 114 | + https://github.com/Pagefind/pagefind/issues/277 |
| 115 | +- Pagefind issue `#574`: |
| 116 | + https://github.com/Pagefind/pagefind/issues/574 |
| 117 | +- HN result set for Pagefind launches: |
| 118 | + https://hn.algolia.com/?q=Pagefind |
0 commit comments