fix: point old-version banner to the matching page on latest - #1620
Draft
neon60 wants to merge 4 commits into
Draft
fix: point old-version banner to the matching page on latest#1620neon60 wants to merge 4 commits into
neon60 wants to merge 4 commits into
Conversation
The "old version" announcement banner linked to a fixed docs root, so clicking it dropped the reader at the top of the latest docs instead of the page they were reading. Add a client-side script that rewrites the banner link (id="rocm-banner") from `.../en/<version>/<page>` to the same `<page>` under `latest`, preserving the project prefix and hash. Missing pages fall back to Read the Docs' own 404 handling for the latest version; non-versioned URLs are left untouched. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Rename fixBannerLatestLink.js to bannerLatestLink.js and drop the "fix" framing. Instead of rewriting any element with id='rocm-banner' (which is also the CSS styling hook), the script now only rewrites links carrying the data-rocm-banner-latest-link attribute. This separates styling from behavior and, crucially, leaves a project's custom `announcement` override untouched unless it opts in by adding the attribute. The three built-in banners carry the attribute, keeping the fixed href as a no-JS fallback. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Document the automatic version banner (old release, release candidate, development), how its link resolves to the matching page on the latest version via bannerLatestLink.js, and how to set a custom announcement - including opting a custom link into the latest-page rewrite with the data-rocm-banner-latest-link attribute. Add the page to the user guide TOC. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
Explain that the href is required and chosen by the author: the script rewrites an existing link rather than creating one, so an <a> without an href is not a working link. The href doubles as the fallback when the rewrite does not run, so it should point at a sensible per-project landing page rather than the ROCm root. Co-Authored-By: Claude Opus 4 (1M context) <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 "old version" announcement banner linked to a fixed docs root, so clicking it dropped the reader at the top of the latest docs instead of the page they were reading. Add a client-side script that rewrites the banner link (id="rocm-banner") from
.../en/<version>/<page>to the same<page>underlatest, preserving the project prefix and hash. Missing pages fall back to Read the Docs' own 404 handling for the latest version; non-versioned URLs are left untouched.Motivation
Technical Details
Test Plan
Test Result
Submission Checklist