Skip to content

Use mkdocs mike for multi-version docs #1885

Open

Description

@meatballhat

Checklist

  • Did you perform a search about this feature? Here's the GitHub guide about searching.

What problem does this solve?

This would remove the need for multiple major version documentation trees within each major maintenance branch.

Solution description

Rework the docs to use the mkdocs mike tool as described here.

Describe alternatives you've considered

Hosting documentation at readthedocs would include support for something similar. We could not switch to mike and continue the in-tree multiple dirs approach.

Activity

  1. added
    kind/documentation
    area/v3
    on Apr 27, 2024
  2. dearchap commented on Jun 7, 2026

    @dearchap
    Contributor

    I've been exploring what switching to mike would involve. Here's the analysis:

    Current Docs Setup

    • All three version doc trees live in docs/v1/, docs/v2/, docs/v3/ on main
    • mkdocs.yml defines nav entries for all three
    • CI runs mkdocs gh-deploy --force on tag push to publish to gh-pages
    • No version selector — users navigate manually between versions

    What mike Does

    mike builds docs per branch and deploys them as versioned directories (/v3/, /v2/, /v1/) on gh-pages, adding a version selector widget via the material theme.

    Required Changes

    1. Dependencies

    • Add mike to mkdocs-requirements.txt

    2. Per-Branch mkdocs.yml

    • main branch: Strip v1/v2 nav, add mike plugin + version selector config
    • v2-maint branch: Create mkdocs.yml with only v2 nav (or backport from main after stripping)
    • v1-maint branch: Same for v1

    3. CI Workflow (publish-docs.yml)

    • Replace mkdocs gh-deploy --force with mike deploy --push --update-aliases <version>
    • Add workflow triggers on v2-maint and v1-maint branches for their respective tag pushes
    • Version aliasing: latest → newest stable release

    4. Doc Directory Restructuring

    • main: Remove docs/v1/ and docs/v2/ (only v3 remains under docs/)
    • v2-maint: Move existing docs/v2/* → docs/* (so doc root = v2 version)
    • v1-maint: Same for v1
    • Common pages (index.md, CONTRIBUTING.md, etc.) would need to exist per branch

    5. Build Tooling

    • Add ensure-mike / deploy-mike targets to scripts/build.go / Makefile
    • Update RELEASING.md with new mike-based workflow

    6. Cross-version Links

    • Migration guides that link between versions need to use versioned URLs (e.g., /v2/... → /v3/...)

    What Stays the Same

    • gfmrun testing (walks docs/ — still works)
    • Custom domain (CNAME) — mike preserves it

    Key Open Question

    Should mike versions correspond to major versions (v3, v2, v1) or individual releases (v3.6.0, v3.7.0, ...)?

    Major-version-level versioning is simpler and matches the current structure (one set of docs per major version). Release-level would let users pin to a specific version but adds complexity.

    I'd lean toward major-version-level with alias: latest pointing to v3. Thoughts?

  3. paoValle commented on Oct 19, 2026

    @paoValle

    The current setup, to check my understanding before proposing a change: mkdocs.yml has in-tree v2/ and v3/ nav trees, and .github/workflows/publish-docs.yml deploys with make deploy-mkdocs (plain mkdocs gh-deploy) only on v3.* tags, after make gfmrun --walk docs/v3/ and make diffcheck.

    mike would replace exactly that last step and let each branch publish its own version into gh-pages instead of keeping a copy of the older tree in each branch:

    • mike in mkdocs-requirements.txt, extra.version.provider: mike in mkdocs.yml (the theme draws the selector, no nav change);
    • on a tag: mike deploy --push --update-aliases "${GITHUB_REF_NAME%.*}" v3 and mike set-default --push <newest v3>, run from the tag's docs tree, so main publishes the next minor as dev and the v2 branch publishes 2.x from its own docs;
    • test-docs stays as it is — the versioning is orthogonal to gfmrun/diffcheck.

    Three things I would want your call on before opening anything:

    1. Aliases: latest pinned to the newest v3, or v3 as a moving alias (mike's --update-aliases) and default set to it?
    2. The v2 branch: is it still built from this repo (a branch that would need the same workflow change), or has it stopped?
    3. gh-pages history: the first mike deploy has to keep the existing site working while the version dirs are rewritten, so I would do the switch in one workflow change rather than a gradual one. Any objection to the tag workflow writing to gh-pages with contents: write (it already does)?

    If you are fine with that shape I can put it up as a PR: the workflow step, the requirements line, the config line, and a short RELEASING.md note. One caveat: I cannot dry-run your Pages deployment, so the first tag after the change is the real test — I would keep the old deploy-mkdocs target in the Makefile for one release so the revert is one line.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/v3kind/documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions