Skip to content

docs: reduce version selector entries and add archive page (Fixes #1395)#1417

Open
jamestwilkinson wants to merge 5 commits into
cubewise-code:masterfrom
jamestwilkinson:docs-archive-and-version-filter
Open

docs: reduce version selector entries and add archive page (Fixes #1395)#1417
jamestwilkinson wants to merge 5 commits into
cubewise-code:masterfrom
jamestwilkinson:docs-archive-and-version-filter

Conversation

@jamestwilkinson

Copy link
Copy Markdown
Contributor

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:

  1. the previous major version
  2. the last three minor versions for the current major
  3. the latest patch for each minor

Updated the GitHub Actions workflow to:

  1. deployed versioned docs using mike
  2. set the default version
  3. updated handling of versions.json

Verified the full deployment pipeline on my fork:

  1. gh-pages branch created
  2. versioned docs deployed
  3. default version redirect working
  4. archive page visible
  5. version selector correctly filtered

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.py to compute visible vs hidden doc versions from versions.json.
  • Added a new Archive page and linked it from the MkDocs navigation.
  • Updated .github/workflows/docs.yml to extract versions.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 thread docs/archive.md
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]

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.

doc: reduce version selector entries and introduce archive page

2 participants