Fix search: remove duplicate results and fix titles - #267
Merged
Conversation
ohookins
force-pushed
the
fix/pagefind-search-results
branch
4 times, most recently
from
August 16, 2026 08:27
3d95ab3 to
4f501d9
Compare
- 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
force-pushed
the
fix/pagefind-search-results
branch
from
August 16, 2026 08:28
4f501d9 to
64afe1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:data-pagefind-bodyto the main content area in Layout — Pagefind now only indexes content within this elementdata-pagefind-ignoreto the Header — the site title<h1>is excluded from indexingResult titles now correctly show the page's own
<h1>(the blog post title).