docs: Fix version switching for API reference pages#1823
Conversation
e7edc4f to
21f5400
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1823 +/- ##
=======================================
Coverage 92.26% 92.26%
=======================================
Files 157 157
Lines 10886 10889 +3
=======================================
+ Hits 10044 10047 +3
Misses 842 842
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Swizzle DocsVersionDropdownNavbarItem to navigate to correct API version paths - Make API navbar link respect the currently selected docs version - Collapse all sidebar categories by default and enable auto-collapse - Remove unreleased changelog section from versioned 1.6 docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
21f5400 to
e96c2a8
Compare
There was a problem hiding this comment.
Pull request overview
Fixes docs-site version navigation for API reference routes by making the version dropdown and API navbar entry aware of API versioned paths, while aligning sidebar UX and cleaning up versioned changelog content.
Changes:
- Swizzles
DocsVersionDropdownNavbarItemto switch versions correctly when browsing/api/*routes. - Replaces the static API navbar link with a custom component that routes to the API path for the currently preferred docs version.
- Collapses sidebar categories by default and removes the unreleased section from the versioned
1.6changelog.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js | New swizzled version dropdown that detects API routes and builds API-version-aware links. |
| website/src/theme/NavbarItem/ComponentTypes.js | Adds custom-api navbar item type that links API to the preferred docs version. |
| website/src/theme/NavbarItem/apiVersionUtils.js | Centralizes API path construction for stable/current/versioned API routes. |
| website/docusaurus.config.js | Switches the navbar “API” item to type: 'custom-api'. |
| website/sidebars.js | Collapses the Introduction sidebar category by default. |
| website/versioned_sidebars/version-1.6-sidebars.json | Collapses Introduction in the 1.6 versioned sidebar. |
| website/versioned_sidebars/version-0.6-sidebars.json | Collapses multiple categories by default in the 0.6 versioned sidebar. |
| website/versioned_docs/version-1.6/changelog.md | Removes the unreleased changelog block from the versioned 1.6 docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Problem
Solution
DocsVersionDropdownNavbarItemto navigate to the correct API version pathsTest plan