Skip to content
Early bird + Black Friday · 73% off

Get ZeroDirs for $179 $49

Claim $49 deal

Search

Search is Pagefind, an index built at pnpm build from the rendered listing pages. features.search turns it on; it is true by default.

  1. Build.

    Terminal
    pnpm build

    It prints one line, where N is the number of listing pages:

    [zerodirs:pagefind] indexed N pages → pagefind/
  2. Serve the build.

    Terminal
    pnpm preview

    Open http://localhost:4321/search/. The status line reads Type at least 2 characters, or pick a filter, to search tools.

  3. Search with the query in the URL.

    Open http://localhost:4321/search/?q=writing. The status line shows <n> tools, or Showing 10 of <n> tools past ten.

  4. Filter without a query.

    Open http://localhost:4321/search/?pricing=free — results appear with nothing typed. Change the sort to Most popular: the address bar gains &sort=popularity and the back button gains nothing.

Where You should see
The bundle ls dist/client/pagefind/ pagefind.js, pagefind-entry.json, index/, fragment/, filter/
One island, on one page the build log zero-js: <n> content pages, 0 islands, 0 external scripts — ok
A result /search/?q=<a listing name> that listing first: logo or letter tile, name, badges, tagline
A shared link the filtered address bar, reopened in a new tab query, filters and sort come back
Only listings /search/?q=<a category name> listings from that category; never the category page itself

The search page on the demo: the query in the box, pricing and category filters, and the result list

  • ⌘K / Ctrl K opens the command palette on every page: a search field, the site’s quick links and its featured listings, filtered as you type; Enter runs the full search on /search/. The ⌘K badge in the home-page field opens it too. The palette is a native <dialog> with server-rendered rows and one inline script, so it needs no Pagefind and works under astro dev. The header has no search field of its own.
  • A detail page that loses its hidden data-pagefind-sort span drops out of sorted results.
  • /search/ is the only page allowed an <astro-island> or a <script src>; integrations/budget.ts fails the build if any other page carries one.
  • /search/ is noindex and disallowed in robots.txt.
  • The URL carries q (up to 200 characters; under 2 the filters search alone), category, tag and pricing (slugs from site.config.ts) and sort (relevance default, popularity, date); category and tag pages link in with ?category=<slug> and ?tag=<slug>.
Config state The visitor sees Fix
features.search: false no search box anywhere (Browse all tools and Categories replace it on the home page), no Search within on category and tag pages, /search/ 404s set it back to true
pnpm dev Search is not available yet. Run `pnpm build`, then `pnpm preview`, to try search locally. expected
The index failed to write a build warning, indexing failed (…); build continues without pagefind/ usually the Pagefind binary for your platform
No page carries data-pagefind-body no page with data-pagefind-body found in …; writing an empty index so /search/ still loads; every search finds nothing pagefindBody() is missing from the detail template
The file budget budget: warns above 80% of the plan limit, fails the build above 90% see Cost and limits

features.search — features. There is no search block: the minimum query length, the result cap and the tagline weight are SEARCH_MIN_QUERY, SEARCH_MAX_RESULTS and SEARCH_META_WEIGHTS in src/lib/search.ts, and the debounce is DEBOUNCE_MS in src/islands/SearchPanel.tsx.

  • integrations/pagefind.ts builds the index at astro:build:done
  • Directorysrc/
    • islands/SearchPanel.tsx the island: filters, sort, URL state, debounce
    • pages/search.astro the only page with an island
    • lib/search.ts the attribute helpers, the URL parser and the constants
    • components/listing/Detail.astro the indexed body: meta, filters, sort carrier