Skip to content

fix(search): filter search results by docs version and show version b…#502

Open
Marias03 wants to merge 2 commits into
payloadcms:mainfrom
Marias03:fix/search-respects-version
Open

fix(search): filter search results by docs version and show version b…#502
Marias03 wants to merge 2 commits into
payloadcms:mainfrom
Marias03:fix/search-respects-version

Conversation

@Marias03
Copy link
Copy Markdown

Closes #492

Problem

When browsing the v2 docs and searching, results redirect to v3 pages instead of staying on v2.

Root Cause

The DocSearch component was not filtering Algolia results by version, returning results from all versions regardless of which version the user was browsing.

Changes

  • Extract URL versioning logic into a getVersionedUrl helper function
  • Fix edge case where URLs already containing /docs/v2/ were being double-replaced
  • Add searchParameters with facetFilters to scope Algolia results to the active version
  • Add TypeScript types to the Hit component props
  • Show a version badge when browsing v2 docs so users know search is scoped to v2
  • Add CSS styles for searchWrapper and versionBadge

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.

Searching the docs in v2 only searches in v3

1 participant