docs: reduce version selector entries and add archive page (Fixes #1395)#1417
Open
jamestwilkinson wants to merge 5 commits into
Open
docs: reduce version selector entries and add archive page (Fixes #1395)#1417jamestwilkinson wants to merge 5 commits into
jamestwilkinson wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the documentation site to reduce clutter in the version selector (by filtering which versions are shown) and adds an “Archive” page intended to provide access to older doc versions. It also reworks the GitHub Actions docs deployment workflow to use mike-managed versioned docs and to set the default version automatically.
Changes:
- Added
scripts/filter_versions.pyto compute visible vs hidden doc versions fromversions.json. - Added a new
Archivepage and linked it from the MkDocs navigation. - Updated
.github/workflows/docs.ymlto extractversions.json, filter versions, deploy versions with mike, and set the default.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| scripts/filter_versions.py | New script to select which versions are “visible” vs “hidden” in the docs selector. |
| mkdocs.yml | Adds “Archive” to the documentation navigation. |
| docs/archive.md | Introduces an archive page placeholder for older documentation versions. |
| .github/workflows/docs.yml | Reworks docs deployment to use mike versioning and the new filtering script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+15
to
+17
| def group_versions(versions): | ||
| parsed = [parse_version(v) for v in versions] | ||
| parsed.sort(reverse=True) |
Comment on lines
+1
to
+5
| # Version Archive | ||
|
|
||
| This page lists all TM1py documentation versions. | ||
|
|
||
| Older versions are accessible here even if they’re hidden from the version selector. |
Comment on lines
+45
to
+47
| - name: Filter versions | ||
| run: | | ||
| python scripts/filter_versions.py versions.json > version_filter_output.json |
Comment on lines
+52
to
+55
| version="v${GITHUB_REF#refs/tags/}" | ||
| echo "Deploying version from tag: $version" | ||
| mike deploy --push "$version" | ||
|
|
Comment on lines
+56
to
+66
| - name: Deploy visible versions | ||
| run: | | ||
| for v in $(jq -r '.visible[]' version_filter_output.json); do | ||
| mike deploy --push $v | ||
| done | ||
|
|
||
| - name: Deploy hidden versions | ||
| run: | | ||
| for v in $(jq -r '.hidden[]' version_filter_output.json); do | ||
| mike deploy --push --hidden $v | ||
| done |
Comment on lines
+68
to
75
| - name: Set default version | ||
| run: | | ||
| latest=$(jq -r '.visible[0]' version_filter_output.json) | ||
| if [ "$latest" = "null" ] || [ -z "$latest" ]; then | ||
| echo "No visible versions found — skipping set-default" | ||
| else | ||
| echo "No CNAME file found in master branch" | ||
| mike set-default --push "$latest" | ||
| fi |
Comment on lines
+1
to
+4
| import json | ||
| import re | ||
| import sys | ||
| from packaging.version import Version |
Comment on lines
+27
to
+51
| def select_visible(parsed, groups): | ||
| visible = [] | ||
|
|
||
| # 1. Previous major version (e.g., v2.x if current is v3.x) | ||
| current_major = parsed[0].major | ||
| previous_major = current_major - 1 | ||
|
|
||
| for v in parsed: | ||
| if v.major == previous_major: | ||
| visible.append(v) | ||
| break # only latest patch of previous major | ||
|
|
||
| # 2. Last 3 minor versions of current major | ||
| current_minor_groups = [ | ||
| g for g in groups.keys() | ||
| if g.startswith(f"{current_major}.") | ||
| ] | ||
| current_minor_groups.sort(reverse=True) | ||
| last_three = current_minor_groups[:3] | ||
|
|
||
| for minor in last_three: | ||
| latest_patch = groups[minor][0] # sorted desc | ||
| visible.append(latest_patch) | ||
|
|
||
| return visible |
Comment on lines
+66
to
+70
| parsed, groups = group_versions(versions) | ||
| visible = select_visible(parsed, groups) | ||
| visible_strings = [f"v{v.public}" for v in visible] | ||
| hidden_strings = [v for v in versions if v not in visible_strings] | ||
|
|
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.
Description
This PR implements the documentation improvements requested in Issue #1395.
Summary
Added an Archive page listing older documentation versions
Implemented version filtering so the selector only shows as visible:
Updated the GitHub Actions workflow to:
Verified the full deployment pipeline on my fork:
Live example from my fork:
https://jamestwilkinson.github.io/tm1py/
Outcome
This PR resolves #1395 by reducing clutter in the version selector and introducing a central archive page.