Repository navigation
Add a version switcher to all docs pages - #35
Merged
Merged
Conversation
Member
|
Sphinx has a native version switcher. Better to use the native one. |
Member
Author
|
Will we get older versions from pre pydata sphinx? Ie. 0.6-0.10? |
garth-wells
approved these changes
Oct 24, 2026
Member
|
I pushed a small cleanup commit (ba70260) to this branch. It doesn't change the injected pages:
I checked it by running the original and new scripts on a full copy of the site. All 15,422 pages came out byte-for-byte identical, and Some things I left for you to decide:
#36 is stacked on this PR. It enables the theme's own version switcher wherever the theme supports it, and this PR's switcher covers the remaining pages. |
garth-wells
added this pull request to stack #37
October 24, 2026 20:50
- Define the project list once, in make_versions.py. - Use one directory walker in inject_switcher.py. - Drop the unused --base-url option; point each versions.json url at the version front page that exists (python/ for dolfinx), not the folder. - Check the candidate pages in parallel when switching versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
garth-wells
force-pushed
the
dokken/version-switcher
branch
from
October 24, 2026 20:52
ba70260 to
843c08a
Compare
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.
Adds a Read-the-Docs-style version dropdown to every page on docs.fenicsproject.org, including old builds and Doxygen pages, without rebuilding anything.
At deploy time,
website.ymlnow:make_versions.py, which writes<project>/versions.jsonfrom the version folders (mainand tags) and marks the newest release as stableinject_switcher.py, which adds one<script>line before</body>in each HTML pageinject_switcher.py --verify ., which fails the job if any published file differs from the repo by more than that lineOnly the Pages artifact is modified; nothing is committed back.
The dropdown opens the same page in the selected version. If that page doesn't exist there, it falls back to the nearest parent page, then to
python/orcpp/. dolfinx Doxygen pages map betweencpp/(v0.1–v0.3) andcpp/doxygen/(v0.4+). Old releases also show a dismissible "newer release available" banner./_fenics/version-switcher.js,/versions.jsonand/<project>/versions.json.Tested on a full copy of the site:
Follow-up: generate the README/index version list from
versions.jsonand removemark_old_docs.py.🤖 Generated with Claude Code