Skip to content

Fix search: remove duplicate results and fix titles - #267

Merged
ohookins merged 1 commit into
mainfrom
fix/pagefind-search-results
Aug 16, 2026
Merged

Fix search: remove duplicate results and fix titles#267
ohookins merged 1 commit into
mainfrom
fix/pagefind-search-results

Conversation

@ohookins

Copy link
Copy Markdown
Owner

Two issues with the Pagefind search:

Duplicate results

<pagefind-searchbox> includes a dropdown with autocomplete results, and <pagefind-results> shows results on the page — creating duplicates. Replaced <pagefind-searchbox> with <pagefind-input> (just the text input, no dropdown).

Wrong result titles

Every result showed "adrift on a cosmic ocean" (the site title from the Header <h1>) instead of the blog post title. Fixed by:

  • Adding data-pagefind-body to the main content area in Layout — Pagefind now only indexes content within this element
  • Adding data-pagefind-ignore to the Header — the site title <h1> is excluded from indexing

Result titles now correctly show the page's own <h1> (the blog post title).

@ohookins
ohookins force-pushed the fix/pagefind-search-results branch 4 times, most recently from 3d95ab3 to 4f501d9 Compare August 16, 2026 08:27
- Replace pagefind-searchbox with pagefind-input to remove the
  dropdown autocomplete (results only show in the page body)
- Add data-pagefind-body to main content area in Layout so Pagefind
  only indexes page content, not header/nav/footer
- Add data-pagefind-ignore to Header to prevent the site title
  being used as the result title for every page
- Result titles now correctly show the blog post title
@ohookins
ohookins force-pushed the fix/pagefind-search-results branch from 4f501d9 to 64afe1c Compare August 16, 2026 08:28
@ohookins
ohookins merged commit f4e8472 into main Aug 16, 2026
4 checks passed
@ohookins
ohookins deleted the fix/pagefind-search-results branch August 16, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant