Skip to content

RFC: version archiving cli + docs version page #3286

@slorber

Description

@slorber

💥 Proposal

A Docusaurus 2 site can grow over time mostly due to:

  • Number of docs
  • Number of versions
  • Number of languages (once supported)

At the same time, we are a React SPA and the build times are impacted by the number of pages to build.

Some users who have lots pages will likely want to improve the build time, and "archive" older versions, as no contributions are being made to these versions anymore, so it's not worth it to keep them in the SPA part of Docusaurus.

What I'd like is to have a docusaurus archive --version 1.0.0 cli that:

  • builds the Docusaurus site on a single version
  • remove the version from the site (versions.json entry, docs folder, sidebar file...)
  • upload the version built as a standalone website (to Netlify, Vercel or other according to configuration)

Then I wonder if we couldn't add the deployment link to some config object (versions.json) and make the docs plugin create automatically a page with all the versions available. We'd link to this page as an item of the version dropdown.

On Docusaurus we have this page, but it's created manually: https://v2.docusaurus.io/versions

Also we don't archive versions so if you really want to read docs 2.0.0-alpha.53 you'd have to build form sources the site locally on the correct git tag, not very convenient.

I wonder if we shouldn't make versions.json an object instead of an array (we could support both for retrocompatibility):

{
  "versions": ["3.0.0", "2.0.0"],
  "archivedVersions": [
    { "name": "1.0.0", "url": "https://myfwk-1.0.0.netlify.com" },
    { "name": "0.1.0", "url": "https://myfwk-0.1.0.netlify.com" }
  ]
}

Does it make any sense?

Note, we need to keep this in a simple json file because we can manipulate a json file programmatically. That wouldn't be so easy if it we needed to append a version somewhere in a regular js file.


Note, when building to a standalone site, the versionsDropdown could become automatically a regular button, and we'd note include any other version in this standalone site.

image

Also worth considering the scenario where the user is using 2 instances of the docs plugin (like /ios and /android) and he wants to archive for example Android version 3: can we filter out all iOS related docs of this archived site?

Metadata

Metadata

Assignees

No one assigned

    Labels

    apprenticeIssues that are good candidates to be handled by a Docusaurus apprentice / traineefeatureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions