Skip to content

Allow to set custom path for versioned docs #11288

@felipecrs

Description

@felipecrs

Have you read the Contributing Guidelines on issues?

Motivation

This issue is a continuation of the discussion started in #10852 (comment).

I would like to generate my own versioned_docs and versions.json out of my release branches like v1 and v2 instead of maintaining them all in the main branch.

Take my sample repository: https://github.com/felipecrs/docusaurus-sample-branched-versions

$ git clone https://github.com/felipecrs/docusaurus-sample-branched-versions
$ cd docusaurus-sample-branched-versions
$ npm install
$ npm start

npm start will also execute ./prepare_versioned_docs.sh which in turn will generate versioned_docs/ and versions.json.

Each directory inside versioned_docs/ will be a copy of the current repository at the specific release branch.

Right now, it does not work because it expects the docs directory to be the root of the versioned doc.

And even if it worked, edit URLs would not, as they are not within the same branch as the current docs.

Thus, I think the only thing I really need to make this work is being able to override the versioned docs path and their edit URLs through the versions.json. Something like:

[
  "v2": {
    "docsPath": "./versioned_docs/version-v2/docs",
    "editUrl": "https://github.com/felipecrs/docusaurus-sample-branched-versions/tree/v2/"
  },
  "v1": {
    "docsPath": "./versioned_docs/version-v1/docs",
    "editUrl": "https://github.com/felipecrs/docusaurus-sample-branched-versions/tree/v1/"
  }
]

Self-service

  • I'd be willing to do some initial work on this proposal myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalThis issue is a proposal, usually non-trivial changestatus: needs triageThis issue has not been triaged by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions