Skip to content

DOC: Add version switcher to documentation - #153

Open
AbhiRKeesara wants to merge 1 commit into
numpy:mainfrom
AbhiRKeesara:feature/docs-version-switcher
Open

AbhiRKeesara wants to merge 1 commit into
numpy:mainfrom
AbhiRKeesara:feature/docs-version-switcher

Conversation

@AbhiRKeesara

Copy link
Copy Markdown
Contributor

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:

  • Add versions.json with entries for dev and 1.1.0 (stable)
  • Configure html_theme_options in conf.py for the version switcher (modeled after NumPy's pattern)
  • Add GitHub icon link to navbar
  • Update copyright year to dynamic range (2005-current) per LICENSE.txt
  • Extend publish_docs_to_pages.yml workflow to:
    • Build versioned docs on release tags (v*)
    • Auto-update versions.json when new releases are published
    • Deploy dev docs to /dev/ and releases to /version/X.Y.Z/
    • Update latest symlink to point to newest release
    • Add root index.html redirect to /latest/ (per maintainer suggestion in DOC: Documentation should be available for different versions #78)
  • Update RELEASE.md to reflect automated docs deployment

Testing:

  • Built docs locally with make html and verified the version switcher appears in the navbar
  • Tested dropdown population using the local versions.json
  • Verified GitHub icon displays next to the version selector
  • Validated workflow YAML syntax with Python yaml parser
image

Notes:

  • The latest symlink and root redirect will take effect on the first release tag push after this is merged
  • Future releases will automatically be added to versions.json by the workflow

AI Disclosure

Used Kiro (AI assistant) for implementation guidance, workflow YAML generation, and drafting this description. Changes were verified locally through docs builds and manual testing.

@mattip

mattip commented Sep 17, 2026

Copy link
Copy Markdown
Member

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.

@AbhiRKeesara

Copy link
Copy Markdown
Contributor Author

@mattip - Thanks for the feedback! I'll remove the index.html creation from CI. After this PR merges, the redirect can be added once manually to gh-pages.

Regarding versions.json: the workflow currently only updates it on release builds (inside the if [ "$IS_RELEASE" = "true" ] block), not on dev builds. Am I reading your comment incorrectly, or is there something else you'd like changed there?

@mattip

mattip commented Sep 17, 2026

Copy link
Copy Markdown
Member

Regarding versions.json: the workflow currently only updates it on release builds

My mistake.

After this PR merges, the redirect can be added once manually to gh-pages

Why not change index.html as part of this PR?

@AbhiRKeesara

Copy link
Copy Markdown
Contributor Author

Thanks for confirming on versions.json.

For index.html, do you mean:

  1. Add a conditional check so the workflow creates it only if it doesn't exist (one-time on first release), or
  2. Open a separate PR targeting gh-pages to add it directly?

@mattip

mattip commented Sep 17, 2026

Copy link
Copy Markdown
Member

Ahh, I see. That file only lives on gh-pages, so yes, a separate PR is needed.

Add a version dropdown to the documentation navbar, modeled after NumPy's
official docs pattern. This allows users to easily switch between different
documentation versions.

Changes:
- Add versions.json with entries for dev, 1.1.0, 0.2.0, 0.1.0
- Update conf.py with html_theme_options for version switcher
- Add GitHub icon link to navbar
- Update copyright year to dynamic range (2005-current) per LICENSE.txt
- Extend publish_docs_to_pages.yml to:
  - Build versioned docs on release tags (v*)
  - Auto-update versions.json when new releases are published
  - Deploy dev docs to /dev/ and releases to /version/X.Y.Z/
  - Update 'latest' symlink to point to newest release
  - Add root index.html redirect to /latest/
- Update RELEASE.md to reflect automated docs deployment

Closes numpy#78
@AbhiRKeesara

Copy link
Copy Markdown
Contributor Author

@mattip Updated the workflow to remove the index.html creation. Opened a separate PR targeting gh-pages for the redirect: #154

@mattip mattip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now

@mattip
mattip requested a review from stefanv September 17, 2026 19:23
@InessaPawson InessaPawson moved this from Needs Review to In Progress in NF Sustaining Open Source Series 2026 Sep 17, 2026
@stefanv

stefanv commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

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.

@AbhiRKeesara

Copy link
Copy Markdown
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

DOC: Documentation should be available for different versions

5 participants