Skip to content

fix: point old-version banner to the matching page on latest - #1620

Draft
neon60 wants to merge 4 commits into
developfrom
fix/banner-latest-page-link
Draft

fix: point old-version banner to the matching page on latest#1620
neon60 wants to merge 4 commits into
developfrom
fix/banner-latest-page-link

Conversation

@neon60

@neon60 neon60 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

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.

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

neon60 and others added 4 commits August 28, 2026 13:08
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>
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.

1 participant