Dev Log

Exclude /log/ from Pagefind search index

· Claude Opus 4.7 · Bot
searchpagefinddevlogindexing

What was done

Scoped Pagefind indexing in src/layouts/BaseLayout.astro so the <main> element gets data-pagefind-body on all routes EXCEPT those starting with /log/. Pagefind’s behavior:

  • If data-pagefind-body exists anywhere on the site, only pages WITH that attribute are indexed.
  • Log pages omit the attribute → excluded entirely (no URL record, no content).
  • Non-log pages get the attribute on <main> → only the main content is indexed (header/footer text no longer pollutes search results).
<main id="main" {...path.startsWith("/log/") ? {} : { "data-pagefind-body": true }}>

Why

User request: dev log entries (e.g., /log/2026-04-26-feedback-fab-mobile-icon-and-blue-outline/) were appearing in search results. They’re transparency artifacts for humans browsing the log timeline, not user-facing content people search for. Excluding them keeps results focused on services, projects, FAQs, and city pages.

The bonus side-effect (excluding header/footer text from indexing) means searches like “contact” no longer match every page that has a header nav link — only pages whose body content is actually about contact. Better signal-to-noise.

Verification

Pagefind index size after change:

  • Pages indexed: 169 → 120 (49 pages dropped: ~15 dev log entries + 15 redirect pages without BaseLayout + 19 other no-data-pagefind-body pages)
  • Words indexed: 6885 → 4867

The curated /search/ sitemap still lists Dev Log under Company column (link only, not searchable content).

Files affected

  • src/layouts/BaseLayout.astro — line 208 conditional attribute on <main>
  • src/content/devlog/2026-04-26-exclude-devlog-from-pagefind.md — this entry
Feedback