Skip to content

Add version banner to docs#1355

Open
AdrianDAlessandro wants to merge 4 commits into
mainfrom
docs-version-banner
Open

Add version banner to docs#1355
AdrianDAlessandro wants to merge 4 commits into
mainfrom
docs-version-banner

Conversation

@AdrianDAlessandro

Copy link
Copy Markdown
Collaborator

Description

This PR adds a banner to the docs as a warning for all non-stable versions of the docs. It includes an amber banner for the dev version and a red banner for old versions. There is no banner for the stable version.

This is achieved by including a header.hbs file, which is a html snippet that MdBook inserts into the generated docs. There is some CSS for stying the banner and some JavaScript to dynamically determine the contents of the banner depending on the version of the docs (determined by the url path). I relied on LLM agents for much of this component.

I have added a stable version of the docs that is built alongside the "old" docs. This is simply a copy of the most recent release. One drawback is that the release corresponding to this stable one (currently v2.1.0) includes the red banner, whereas the stable one does not. This is slightly misleading.

I have also developed a version selector widget, but I have put that in a separate PR because it includes some more executive decisions that I have made about the docs.

Fixes #1188

Assisted-by: Claude Sonnet 4.6

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.80%. Comparing base (934b359) to head (64b81dd).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1355   +/-   ##
=======================================
  Coverage   88.80%   88.80%           
=======================================
  Files          58       58           
  Lines        8516     8516           
  Branches     8516     8516           
=======================================
  Hits         7563     7563           
  Misses        640      640           
  Partials      313      313           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Adds a version-aware warning banner to the mdBook documentation site so users can tell when they’re reading development docs vs older release docs, and introduces a “stable” docs build that avoids showing the “old version” warning.

Changes:

  • Add theme/header.hbs with CSS + JS to render a version banner based on the URL path.
  • Add a “Stable version” entry to the generated versions page.
  • Update the old-docs build script to copy the current theme into release worktrees and to produce a release/stable/ copy of the latest release.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
theme/header.hbs Adds the banner markup/styles/script to mdBook pages and offsets layout when the banner is shown.
docs/templates/versions.md.jinja Adds a link to the new stable docs path.
docs/build_old_docs.py Ensures old releases use the current theme and generates a stable docs directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/build_old_docs.py
Comment on lines +109 to +111
# Copy latest release into stable dir
if i == 0:
shutil.copytree(release_outdir, outdir / "stable")
Comment thread theme/header.hbs
}
</style>

<div id="version-banner"></div>
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.

Add banner to top of "old docs" telling users it is an old version of the documentation

2 participants