Repository navigation
Native version switcher and latest-release links, on top of the injected switcher - #36
Merged
Merged
Conversation
This was referenced Oct 24, 2026
Member
|
Can you comment on how this differs from: #35 |
Member
Author
Member
|
Will we get older versions in the dropdown, ie everything pre sphinx pydata theme? |
garth-wells
force-pushed
the
version-switcher
branch
2 times, most recently
from
October 24, 2026 20:39
753db8a to
61c8fb0
Compare
Member
Author
garth-wells
force-pushed
the
version-switcher
branch
from
October 24, 2026 20:52
61c8fb0 to
b75bff5
Compare
make_switcher.py writes a pydata-sphinx-theme version switcher JSON per documentation set from the published version folders, and redirect pages so that e.g. /dolfinx/python/ always opens the latest release. Only the newest .postN of each release is listed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Releases built with pydata-sphinx-theme before the switcher was configured already ship the theme code that renders it. At deploy time, add the switcher options and markup to those pages and drop the version from the title, so the latest-release redirects land on a page with the dropdown. make_switcher.py now writes only into the deploy folder, so patching published pages never touches the repository checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Older pydata-sphinx-theme versions decide whether a page is the stable version by comparing release numbers, which fails for .postN releases and showed a "switch to stable version" banner on the stable release itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entries are named and matched by release (e.g. v0.10.0), and link to the newest .postN build. All .postN builds of a release highlight its entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- inject_switcher.py skips pages that already have the pydata-sphinx-theme version switcher, i.e. builds made with it configured. - make_switcher.py runs after inject_switcher.py and its check. On releases built with pydata-sphinx-theme it enables the native switcher and removes the injected one, so every page has exactly one switcher. - versions.json lists one entry per release, without .postN, matching the native lists; the injected switcher matches .postN builds to their release and opens its newest build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
garth-wells
force-pushed
the
version-switcher
branch
from
October 24, 2026 20:52
b75bff5 to
984a533
Compare
- Read the versions from the versions.json files written by make_versions.py instead of rebuilding them, so the release and stable rules exist once. - Share release(), BASE_URL, the injected tag and the directory walker with make_versions.py and inject_switcher.py. - Give each library its subfolders explicitly, rather than relying on the order of a table for the library redirect. - Leave .gitignore unchanged. Co-Authored-By: Claude Opus 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.
Stacked on #35. This PR targets #35's branch and changes only what's needed to combine the two. When #35 merges, GitHub retargets this PR to
main.Together they put exactly one version dropdown on every page:
This PR also adds a single, unversioned link per package that always opens the latest release.
Changes on top of #35
make_switcher.pyruns inwebsite.ymlafter #35's injection and check, and writes only below_html. It:dolfinx/switcher-python.json,dolfinx/switcher-cpp.json,basix/switcher-python.json,ffcx/switcher.json,ufl/switcher.json. They are built from theversions.jsonfiles thatmake_versions.pywrites earlier in the same deploy, so both switchers list the same releases and agree on which is stable./dolfinx/,/dolfinx/python/,/dolfinx/cpp/,/basix/,/basix/python/,/basix/cpp/,/ffcx/,/ufl/. The README gains a section with these links..postNreleases as old.Changes to #35's files:
inject_switcher.pyskips pages that already have the native switcher.make_versions.pyandversion-switcher.jslist one entry per release, without.postN(e.g.v0.10.0), as the native lists do. The injected switcher matches.postNbuilds to their release and opens the release's newest build.#35's check (
inject_switcher.py --verify) runs unchanged, beforemake_switcher.pychanges anything.Testing
I ran the
website.ymlsteps on a full copy of the published site, with themainfolders replaced by docs built locally from the four package PRs, and checked every page with a script. I also checked a local preview in a browser.This repository's CI only runs on PRs to
main, so it will run here once #35 merges.AI assistance: I used Claude Code (Claude Opus 5.5) to draft parts of this PR. I reviewed, edited, tested, and take responsibility for the final contribution.
🤖 Generated with Claude Code