Skip to content

feat: implement dynamic branch based docs versioning#757

Open
Jaydeep869 wants to merge 2 commits intoin-toto:mainfrom
Jaydeep869:feat/docs-versioning
Open

feat: implement dynamic branch based docs versioning#757
Jaydeep869 wants to merge 2 commits intoin-toto:mainfrom
Jaydeep869:feat/docs-versioning

Conversation

@Jaydeep869
Copy link
Copy Markdown
Contributor

Description

This PR resolves #537 by introducing dynamic, branch based versioning for the Docusaurus documentation site.

As suggested in the issue, rather than relying on Docusaurus's default behavior (which permanently duplicates older docs entirely into the master branch and creates significant clutter over time), this approach allows maintaining older versions purely on remote Git branches named docs/X.Y.Z.

Changes made

  1. Docusaurus Config: Enabled { type: 'docsVersionDropdown' } in docusaurus.config.js to render a native version dropdown for users to toggle.
  2. Dynamic Build Script: Added a custom build hook build-versions.sh script that runs in CI. Before npm run build is called:
    • It scans for any branches matching docs/* (e.g. docs/0.7.0).
    • It uses git archive to pull only the documentation from those specific older branches.
    • It seamlessly injects them into the native Docusaurus versioned_docs/ folder right at build time.
    • Dynamically generates the required versions.json.

How to release a new version of docs going forward:

Whenever the maintainers want to snapshot a version (e.g., 0.6.0), all they have to do is check out the commit they want and run:
git checkout -b docs/0.6.0 && git push origin docs/0.6.0
The setup in this PR will then automatically include it in the version dropdown!

Fixes #537

Acceptance Criteria Met

  • Docs changes if needed
  • Testing changes if needed
  • All workflow checks passing (automatically enforced)
  • All review conversations resolved (automatically enforced)
  • DCO Sign-off

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 5, 2026

Deploy Preview for witness-project ready!

Name Link
🔨 Latest commit 9d115f8
🔍 Latest deploy log https://app.netlify.com/projects/witness-project/deploys/69d36257ae96da00087a2aac
😎 Deploy Preview https://deploy-preview-757--witness-project.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@manzil-infinity180
Copy link
Copy Markdown
Contributor

i don't see any dropdown for version? could you send me video or ss?

@Jaydeep869 Jaydeep869 force-pushed the feat/docs-versioning branch from 24e8dbc to 7f63996 Compare April 5, 2026 20:47
@Jaydeep869
Copy link
Copy Markdown
Contributor Author

Jaydeep869 commented Apr 5, 2026

hey @manzil-infinity180 I can see the version selector entry as Next in the docs navbar.
At the moment no semver docs branch (docs/X.Y.Z) exists in in-toto/witness yet, so only current docs are shown.
Once a branch like docs/0.1.0 is created in upstream, it will appear in the selector automatically.

Before

https://witness.dev/

Screenshot from 2026-04-05 18-26-06

After

https://deploy-preview-757--witness-project.netlify.app/

Screenshot from 2026-04-05 18-25-59

@Jaydeep869 Jaydeep869 force-pushed the feat/docs-versioning branch 4 times, most recently from 6e326e7 to 14887b5 Compare April 5, 2026 22:41
Signed-off-by: jaydeep869 <jaydeeppokhariya2106@gmail.com>
@Jaydeep869 Jaydeep869 force-pushed the feat/docs-versioning branch from 14887b5 to a7496ea Compare April 6, 2026 07:33
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.

[Feat]: Improving docs site with versions

2 participants