Repository navigation
feat(website): highlight search matches on destination pages - #12439
Closed
Timothee Guerin (timotheeguerin) wants to merge 2 commits into
Closed
Timothee Guerin (timotheeguerin) wants to merge 2 commits into
Timothee Guerin (timotheeguerin) wants to merge 2 commits into
Conversation
Contributor
|
No changes needing a change description found. |
Timothee Guerin (timotheeguerin)
marked this pull request as ready for review
October 29, 2026 18:26
Timothee Guerin (timotheeguerin)
requested review from
catalinaperalta,
iscai-msft,
Laurent Mazuel (lmazuel) and
Mark Cowlishaw (markcowl)
as code owners
October 29, 2026 18:26
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the search-context and destination-highlighting changes.
No open issues 🎉
What changed in this PR
Extends the shared Astro search component so users retain search context when opening results, including long API reference pages.
Changes:
- Adds search terms to result URLs while preserving heading anchors and excluding scope prefixes.
- Loads Pagefind’s built-in destination highlighter only on production pages with a non-empty
highlightparameter. - Documents the behavior and adds a feature changelog entry.
| File | Description |
|---|---|
packages/astro-utils/src/components/search.astro |
Configures highlight parameters and conditionally loads Pagefind’s highlighter. |
packages/astro-utils/README.md |
Documents destination highlighting and loading conditions. |
.chronus/changes/astro-utils-search-highlights.md |
Records the feature with a scoped-search URL example. |
Review effort: Balanced
|
You can try these changes here
|
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.
Search excerpts show the relevant text, but opening a result loses that context, especially on long Typekit reference pages.
Use Pagefind's built-in destination highlighting. Result links carry the search terms while retaining heading anchors, so
api: isHttpFileopens the HTTP Typekit method with its matches highlighted. The selector prefix is not part of the highlighted query.The supplied highlighting script loads only on production pages with a non-empty
highlightparameter. No custom highlighter or new dependency is needed.Verified ordinary and scoped searches, heading links, light/dark themes, mobile layout, and root/nested deployment paths.
Follow-up to #12435.