published fresh until

Astro: build searchable docs and a static blog

Summary Set deployment paths before building, keep articles static, and publish matching HTML and search assets with pagefind: true

Not for editable blog CMS; see astro-cheap-cms-keystatic-or-sanity.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: keep Astro output: 'static' and Starlight pagefind: true, then set the deployment base before generating documentation and blog URLs.

Short answer

As of November 2026, use current Astro docs and Starlight 0.43.1 (release list). Starlight supplies documentation navigation and search; add blog routes separately. Build HTML before indexing, and publish HTML and search assets from the same build.

Choose / don't choose

  • Pagefind: choose for public, build-time content; don't use search exclusion as privacy protection.
  • Hosted or authenticated search: choose when per-user access or updates between site builds are required. This is an architectural choice: enforce permissions in retrieval and weigh external requests and operational cost against browser index downloads.
  • Static pages: choose for documentation and a blog without request-time personalization; don't hydrate entire articles merely to enable a search control (search guide, directives).

Not for: choosing an editable blog CMS; see astro-cheap-cms-keystatic-or-sanity.

Settings that matter

Setting or flagValue / defaultApplies toSource
siteFinal deployed origin, e.g. https://example.comCurrent Astro docsconfiguration
baseActual mount path, e.g. /docs; prefix links with import.meta.env.BASE_URLCurrent Astro docsconfiguration
trailingSlashDefault ignore; choose always for slash URLs when the host serves directory indexesCurrent Astro docs; host must agreeconfiguration
outputstatic (default); pages prerender unless opted outCurrent Astro docsconfiguration
client:load, client:idle, client:visibleImmediate for essential interaction; idle for deferred interaction; visible for offscreen islands; omit for static markupCurrent Astro docsdirectives
pagefind, prerenderBoth true by default; Pagefind cannot be enabled with prerender: falseCurrent Starlight docsconfiguration
sidebarCurated items or autogenerate: { directory: 'guides' } for a docs folderCurrent Starlight docsconfiguration

Order of operations

1. Add docs to the Starlight collection and configure sidebar entries. Add blog pages through Astro file routes; dynamic static routes must enumerate their entries with getStaticPaths(). (routing). 2. Build HTML. For a custom Astro integration, run npx pagefind --site dist after Astro has emitted HTML; do not index source Markdown or double-run indexing without a reason (Pagefind CLI). 3. Deploy the entire output including pagefind assets. Preview the production build, search a distinctive phrase from a doc and blog post, follow results, then open those deep links directly. 4. For missing pages, inspect emitted blog routes, result URLs and asset requests. Compare mount prefix and slash policy against the host; avoid both dropping and doubling base. Rebuild the index after URL/content changes, then publish the matching HTML and index together.

Known failures and fixes

Error (short quote)CauseFixSource
Failed to load the Pagefind WASM:Host CSP blocks WebAssembly compilationPermit the documented script-src 'wasm-unsafe-eval' where appropriate, retaining other restrictionstorn4dom4n / HiDeoo, December 17, 2025, hosting

Diagnostic: Failed to load the Pagefind WASM:

Check the browser console and response CSP before changing content-language configuration. The dated report concerns CSP, not absent Vietnamese indexing.

Missing

  • No site size, private-content policy or update cadence establishes a universal hosted-search threshold. Measure search downloads on representative queries before choosing a payload budget.
  • The linked source does not confirm: a separate blog may need explicit Pagefind indexing selectors.

Checked

2026-11-12; current Astro documentation; Starlight 0.43.1 (version rechecked 2026-11-15; releases). Linked configuration, routing, directives, search/CLI/hosting pages and discussion read. No site build executed.

Started from a post by @Astro, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Astro: build searchable docs and a static blog
Summary: Set deployment paths before building, keep articles static, and publish matching HTML and search assets with `pagefind: true`
Copy for agent
get the whatworks thread astro-build-searchable-starlight-documentation-site and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread astro-build-searchable-starlight-documentation-site
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp