DOC: Add version switcher to documentation - #153
AbhiRKeesara wants to merge 1 commit into
Conversation
|
Cool. Creating the index.html is a once-off, no need to do it repetitively in CI. Also creating the version json need only happen on release, not on dev builds. |
|
@mattip - Thanks for the feedback! I'll remove the Regarding |
My mistake.
Why not change index.html as part of this PR? |
|
Thanks for confirming on For
|
|
Ahh, I see. That file only lives on gh-pages, so yes, a separate PR is needed. |
83d329f to
1073f61
Compare
|
I think this PR can be simplified significantly. We can unconditionally generate the list of versions on each docs build without penalty. The docs repo, into which we're pushing, contains the list of versions already, and the latest version is stable. I am on a phone now, but can review a bit more carefully later. If this feels urgent, go ahead and merge then I will refactor. Otherwise polishing it up a bit will, I think, make the flow easier to follow. |
|
@stefanv - Thanks for the feedback! No urgency on my end. Happy to wait for your detailed review and simplify based on your suggestions. The cleaner the final implementation, the better. |
Add pydata-sphinx-theme version switcher dropdown to navigate between documentation versions. The switcher appears in the navbar and lists dev, stable, and historical releases. Implementation: - Trigger workflow on v* tags (in addition to main branch) - Deploy release docs to /version/X.Y.Z/, dev docs to /dev/ - Generate versions.json by scanning existing directories on gh-pages - Mark highest non-prerelease version as stable with preferred flag - Update latest symlink on releases Simplifications per maintainer feedback: - Regenerate versions.json on every build by scanning directories - Remove static versions.json from source (generated dynamically) - Always use absolute URL in conf.py (no local fallback) Safety improvements: - Explicit VERSION=dev check prevents unexpected triggers - Handle re-runs gracefully (no-op if nothing changed) Closes numpy#78
1073f61 to
2b7ac96
Compare
|
Hi @stefanv, Simplified per your feedback. The workflow now regenerates Also added safety checks for re-runs and unexpected triggers. Happy to simplify further if you see opportunities. |
PR summary
Closes #78
What problem does this PR solve?
The documentation currently has no way for users to switch between versions. Users visiting the homepage see a static landing page rather than being directed to the latest stable docs.
Why are you interested in working on this PR?
I'm participating in the NumFOCUS Sustaining Open Source Series program and picked this issue to help improve the documentation experience.
Changes:
html_theme_optionsinconf.pyfor the version switcher (modeled after NumPy's pattern)publish_docs_to_pages.ymlworkflow to:v*) in addition to main branch/dev/and releases to/version/X.Y.Z/versions.jsonby scanning existing directories on gh-pageslatestsymlink to point to newest releaseRELEASE.mdto reflect automated docs deploymentSimplifications per maintainer feedback:
versions.jsondynamically by scanning directories instead of maintaining stateversions.jsonfrom source (no longer needed)Testing:
make htmland verified the version switcher appears in the navbarNotes:
latestsymlink andversions.jsonwill be created on the first build after mergeAI Disclosure
Used AI for implementation guidance, workflow generation, code review, and drafting this description. Changes were verified locally through docs builds and manual testing.