Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(plugin-docs): remove legacy versioned prefix on doc ids and sidebar names in versioned sidebars #9310

Merged
merged 9 commits into from
Sep 15, 2023

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Sep 15, 2023

Breaking change

Docusaurus v3 does not support anymore the legacy versioned sidebar files that add a versioned prefix to all doc ids and sidebar names.

For example, this versioned sidebar file is now invalid.

{
   "version-v2.0.0/docs":[
     "version-v2.0.0/introduction-to-relay",
     "version-v2.0.0/prerequisites",
   ]
}

The fix is simple: remove the version-v2.0.0/ prefix everywhere

Motivation

Fix #6018

Very early Docusaurus v2 versions used to create versioned sidebar files with useless "versioned prefixes.

Example from an older version of the Relay website: https://github.com/facebook/relay/blob/main/website/versioned_sidebars/version-v2.0.0-sidebars.json

{
   "version-v2.0.0/docs":[
      {
         "type":"category",
         "label":"Introduction",
         "items":[
            {
               "type":"doc",
               "id":"version-v2.0.0/introduction-to-relay"
            },
            {
               "type":"doc",
               "id":"version-v2.0.0/prerequisites"
            },
            {
               "type":"doc",
               "id":"version-v2.0.0/installation-and-setup"
            },
            {
               "type":"doc",
               "id":"version-v2.0.0/quick-start-guide"
            }
         ]
      }
   ]
}

We stopped adding that prefix a long time ago in Docusaurus v2, but still kept supporting these version prefixes, at the cost of increased complexity.

In Docusaurus v3, we remove this historical retrocompatible support and clean the Docusaurus codebase from that extra complexity.

If your oldest sidebar files still use these version prefixes, please remove them. The example above should be refactored to:

{
   "docs":[
      {
         "type":"category",
         "label":"Introduction",
         "items":[
            {
               "type":"doc",
               "id":"introduction-to-relay"
            },
            {
               "type":"doc",
               "id":"prerequisites"
            },
            {
               "type":"doc",
               "id":"installation-and-setup"
            },
            {
               "type":"doc",
               "id":"quick-start-guide"
            }
         ]
      }
   ]
}

Test Plan

CI

Test links

Deploy preview: https://deploy-preview-9310--docusaurus-2.netlify.app/

@slorber slorber added the pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. label Sep 15, 2023
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Sep 15, 2023
@slorber slorber changed the title chore(plugin-docs): remove legacy versioned doc ids and sidebar names in versioned sidebars chore(plugin-docs): remove legacy versioned prefix on doc ids and sidebar names in versioned sidebars Sep 15, 2023
@netlify
Copy link

netlify bot commented Sep 15, 2023

[V2]

Name Link
🔨 Latest commit 00c3f1b
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/650486fbaadefd000843316f
😎 Deploy Preview https://deploy-preview-9310--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 site configuration.

@github-actions
Copy link

github-actions bot commented Sep 15, 2023

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 74 🟢 97 🟢 92 🟢 100 🟠 89 Report
/docs/installation 🟠 73 🟢 98 🟢 92 🟢 100 🟠 89 Report

@slorber slorber merged commit 598b320 into main Sep 15, 2023
28 of 29 checks passed
@slorber slorber deleted the slorber/docs-unversionedId-remove branch September 15, 2023 16:52
@github-actions
Copy link

Size Change: 0 B

Total Size: 1.11 MB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 117 kB
website/build/assets/css/styles.********.css 113 kB
website/build/assets/js/main.********.js 836 kB
website/build/index.html 41.4 kB

compressed-size-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: breaking change Existing sites may not build successfully in the new version. Description contains more details.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plan for deprecation & removal of doc versioned id
2 participants