Skip to content

feat(website): highlight search matches on destination pages - #12439

Closed
Timothee Guerin (timotheeguerin) wants to merge 2 commits into
microsoft:mainfrom
timotheeguerin:website/search-highlights
Closed

Timothee Guerin (timotheeguerin) wants to merge 2 commits into
microsoft:mainfrom
timotheeguerin:website/search-highlights

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

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: isHttpFile opens 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 highlight parameter. 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.

Search result destination with isHttpFile highlighted in the HTTP Typekit reference and its heading anchor preserved

@github-actions

Copy link
Copy Markdown
Contributor

No changes needing a change description found.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 highlight parameter.
  • 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

Copilot AI balanced review requested due to automatic review settings October 29, 2026 18:41
@azure-sdk-automation

azure-sdk-automation Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the destination-page search highlighting change.

No open issues 🎉

Review effort: Balanced

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.

2 participants