Skip to content

fix(docs): stop the version banner showing on the stable docs - #144

Merged
arokem merged 1 commit into
tee-ar-ex:mainfrom
arokem:fix/doc-version-switcher-stable-redux
Sep 10, 2026
Merged

arokem merged 1 commit into
tee-ar-ex:mainfrom
arokem:fix/doc-version-switcher-stable-redux

Conversation

@arokem

@arokem arokem commented Sep 10, 2026

Copy link
Copy Markdown
Member

Note

This is a repeat of #142 , but with a merge into main instead of to master

The version switcher marked a synthetic {"version": "stable"} entry as preferred. pydata-sphinx-theme gates the warning banner on

const i = t(o) && t(s);          // t = /^[v\d]/ + semver regex
if (i && n(o, s, "=")) return;   // suppress banner

where s is the preferred entry's version. t("stable") is false, so the suppression branch was unreachable and every page rendered "This is documentation for version 0.5.0. [Switch to stable version]" — including /stable/ itself, whose button linked back to the current page.

Drop the pseudo-version entry: the newest release is now the preferred one and is served from the /stable/ alias, named "0.5.0 (stable)". Older releases keep their own versioned URL, so they correctly report "an old version (X.Y.Z)" instead of a bare "version X.Y.Z".

Also in the release workflow:

  • Read switcher.json from the gh-pages worktree instead of curl-ing the published site, which is served through a CDN cache and could hand the build a stale copy.
  • Only copy to stable/ when the tag is the newest release, so a backport tag cannot demote a newer one.
  • Add a workflow_dispatch job that rebuilds switcher.json from the version folders present on gh-pages, to fix the live site without cutting a release. The folder list is used rather than git tags because tags predating the versioned docs have no folder to link to.

Closes #141

The version switcher marked a synthetic `{"version": "stable"}` entry as
preferred. pydata-sphinx-theme gates the warning banner on

    const i = t(o) && t(s);          // t = /^[v\d]/ + semver regex
    if (i && n(o, s, "=")) return;   // suppress banner

where `s` is the preferred entry's version. `t("stable")` is false, so the
suppression branch was unreachable and every page rendered
"This is documentation for version 0.5.0. [Switch to stable version]" —
including /stable/ itself, whose button linked back to the current page.

Drop the pseudo-version entry: the newest release is now the preferred one
and is served from the /stable/ alias, named "0.5.0 (stable)". Older
releases keep their own versioned URL, so they correctly report "an old
version (X.Y.Z)" instead of a bare "version X.Y.Z".

Also in the release workflow:

- Read switcher.json from the gh-pages worktree instead of curl-ing the
  published site, which is served through a CDN cache and could hand the
  build a stale copy.
- Only copy to stable/ when the tag is the newest release, so a backport
  tag cannot demote a newer one.
- Add a workflow_dispatch job that rebuilds switcher.json from the version
  folders present on gh-pages, to fix the live site without cutting a
  release. The folder list is used rather than git tags because tags
  predating the versioned docs have no folder to link to.

Closes tee-ar-ex#141
@arokem
arokem merged commit 22d1e54 into tee-ar-ex:main Sep 10, 2026
20 checks passed
@arokem

arokem commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

This worked as expected!

Screenshot 2026-09-10 at 9 19 50 AM

arokem added a commit that referenced this pull request Sep 17, 2026
Follow up from #144

This is causing failures only when testing sdist, because it can only
be tested in the context of an installation.

Here the following code:

```
TOOLS_DIR = Path(__file__).resolve().parents[2] / "tools"
```

resolved incorrectly, because the test file is located at
`trx/tests/test_update_switcher.py`, not `tests/test_update_switcher.py`
So, going up 2 parents from that location would be wrong and raises
that error in the CI.
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.

Banner at the top of doc website alludes to a "stable" version

2 participants