Skip to content

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

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

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

Conversation

@waqarilyas

Copy link
Copy Markdown

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 and 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.

Test plan

  • pnpm install --frozen-lockfile
  • pnpm test packages/docusaurus-plugin-content-docs
  • pnpm test packages/docusaurus-plugin-content-docs/src/__tests__/versionedDocsPath.test.ts packages/docusaurus-plugin-content-docs/src/versions/__tests__/files.test.ts
  • pnpm 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
  • pnpm 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

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Jun 19, 2026
@netlify

netlify Bot commented Jun 19, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

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

@im-made-of-jam

This comment was marked as spam.

@MrDoomBringer

This comment was marked as spam.

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

3 participants