Repository navigation
API Explorer: keep the same page when switching versions - #4542
Merged
Merged
Conversation
The version picker linked to each version's landing page. It now links to the same page in the other version when that version has it, and to its landing page otherwise. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4542/ Sample changed pages: |
akira28
approved these changes
Oct 22, 2026
Version picker links are boosted again. A move between versions swaps the whole main container, so the navigation tree and the picker follow the new version. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The API product switcher and the All APIs link are boosted. A move to another product swaps the whole main container, and the isolated header title follows the new API. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… review by @infra-vault-gh-plugin-prod) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
The API version picker now opens the same page in the other version when that version has it, such as the same operation. Before, it always opened the version's landing page.
Affects: API reference, Site UI
Prompt summary: Implement elastic/docs-eng-team#1081. Choosing another version on an API page should keep the reader on the same operation if it exists there, as Bump.sh does. Version and API switches should behave like htmx links.
Why
The picker only knew the root URL of each version, so every page linked to the same landing pages. A reader on an operation lost their place after a version switch. The issue reporter calls this a blocker for their API.
Closes elastic/docs-eng-team#1081
What
Same-page links
Each version now records which pages it renders. A page links to the matching page in another version when that version has it. Otherwise it links to that version's landing page, as before. Collapsed operations count under their former URLs too.
Build order
The generator builds every version's navigation before any page renders, because a page must know what the other versions contain. Total work is the same. Build time did not change in a local run on
docs/(about 23 to 27 seconds for both, three runs each, inside run-to-run noise).Pickers and htmx
The version picker, the API product switcher and the All APIs link are normal boosted links, so switching does not reload the page. Within one API, boosted navigation swaps only the content grid, and the pickers sit outside it. A small script copies the new version links from each response, so the picker follows the page the reader is on. A move to another version or product swaps the whole main container instead, so the navigation tree and the context bar follow. The isolated header is preserved across swaps, so the script also copies its title. Only a move between a docs page and an API page still reloads, because the site header differs.
Verify
Open
/api/doc/elasticsearch/operation/operation-search-application-get-behavioral-analyticsand pickv9. The page stays on the same operation. On an operation that exists only inmain, pickingv8opens the v8 landing page.Check on the preview
v9andv8in the version picker: each opens the same operation.mainandv9only. Pickv8: it opens the v8 landing page.🤖 Generated with Claude Code