Skip to content

feat(content-docs): support custom versioned docs path#12105

Open
waqarilyas wants to merge 1 commit into
facebook:mainfrom
waqarilyas:fix/8061-versioned-docs-path
Open

feat(content-docs): support custom versioned docs path#12105
waqarilyas wants to merge 1 commit into
facebook:mainfrom
waqarilyas:fix/8061-versioned-docs-path

Conversation

@waqarilyas
Copy link
Copy Markdown

Summary

Fixes #8061.

This adds a versionedDocsPath option to @docusaurus/plugin-content-docs, allowing projects to keep generated versioned docs and sidebars outside the site directory.

By default, nothing changes: versioned docs are still written to the site directory under versioned_docs and versioned_sidebars.

Motivation

Some projects keep their docs content outside the Docusaurus site root, but docusaurus docs:version always writes generated version folders back into the site directory. This makes monorepo and multi-docs setups harder to organize.

With versionedDocsPath, the docs plugin can write:

  • versioned_docs
  • versioned_sidebars

under a configured directory instead.

Changes

  • Adds versionedDocsPath to the docs plugin options and TypeScript types.
  • Updates version metadata path resolution to read versioned docs/sidebars from the configured path.
  • Updates the docs:version CLI flow to write generated docs/sidebars to that path.
  • Documents the new option in the plugin API docs and versioning guide.
  • Adds regression coverage for the new path helpers and CLI behavior.

Related issue

Fixes #8061.

Test plan

  • yarn install --frozen-lockfile
  • yarn test packages/docusaurus-plugin-content-docs
  • yarn test packages/docusaurus-plugin-content-docs/src/__tests__/versionedDocsPath.test.ts packages/docusaurus-plugin-content-docs/src/versions/__tests__/files.test.ts
  • yarn eslint --cache --report-unused-disable-directives packages/docusaurus-plugin-content-docs/src/cli.ts packages/docusaurus-plugin-content-docs/src/options.ts packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts packages/docusaurus-plugin-content-docs/src/versions/files.ts packages/docusaurus-plugin-content-docs/src/__tests__/versionedDocsPath.test.ts packages/docusaurus-plugin-content-docs/src/versions/__tests__/files.test.ts
  • yarn oxfmt packages/docusaurus-plugin-content-docs/src/cli.ts packages/docusaurus-plugin-content-docs/src/options.ts packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts packages/docusaurus-plugin-content-docs/src/versions/files.ts packages/docusaurus-plugin-content-docs/src/__tests__/versionedDocsPath.test.ts packages/docusaurus-plugin-content-docs/src/versions/__tests__/files.test.ts website/docs/api/plugins/plugin-content-docs.mdx website/docs/guides/docs/versioning.mdx

AI-assisted.

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Jun 1, 2026

Hi @waqarilyas!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit d663d31
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a1da020666b0c0008ad0ca7
😎 Deploy Preview https://deploy-preview-12105--docusaurus-2.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.

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Jun 1, 2026
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Jun 1, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

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

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output directory of versioning - {PLUGIN_INSTANCE_ID}_versioned-docs should be configurable

1 participant