feat(content-docs): support custom versioned docs path#12105
Conversation
|
Hi @waqarilyas! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary
Fixes #8061.
This adds a
versionedDocsPathoption 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_docsandversioned_sidebars.Motivation
Some projects keep their docs content outside the Docusaurus site root, but
docusaurus docs:versionalways 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_docsversioned_sidebarsunder a configured directory instead.
Changes
versionedDocsPathto the docs plugin options and TypeScript types.docs:versionCLI flow to write generated docs/sidebars to that path.Related issue
Fixes #8061.
Test plan
yarn install --frozen-lockfileyarn test packages/docusaurus-plugin-content-docsyarn test packages/docusaurus-plugin-content-docs/src/__tests__/versionedDocsPath.test.ts packages/docusaurus-plugin-content-docs/src/versions/__tests__/files.test.tsyarn 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.tsyarn 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.mdxAI-assisted.