Skip to content

feat(v2): docs version banner configuration option#5052

Merged
slorber merged 5 commits intomasterfrom
slorber/version-banner-config
Jun 24, 2021
Merged

feat(v2): docs version banner configuration option#5052
slorber merged 5 commits intomasterfrom
slorber/version-banner-config

Conversation

@slorber
Copy link
Collaborator

@slorber slorber commented Jun 24, 2021

Breaking changes:

  • @theme/DocVersionSuggestions component API modified, and component is renamed to DocVersionBanner.
  • Both @theme/DocVersionSuggestions and @theme/DocItem should probably be reswizzled/updated

Motivation

Fixes #3013

By default, we display a banner at the top of docs versions that are not the latest version, saying the version is either unreleased or unmaintained.

This is a problem for some sites that want to disable this banner.

Currently, the only solution is swizzle the banner component, which is a bit annoying for users.

This PR adds a new version config option so that the banner can be customized/disabled per-version.

const docsOptions = {
  versions: {
    current: {
      banner: "none"
    }
    "1.0.0": {
      banner: "none"
    }
  }
};

This may not be the best API in case you want to disable the site on ALL banners at once, but is a good low-level first step enabling the user to disable banners without swizzling. We can introduce more APIs for that later.

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

tests

@slorber slorber added pr: new feature This PR adds a new API or behavior. pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. labels Jun 24, 2021
@slorber slorber requested a review from lex111 as a code owner June 24, 2021 15:24
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jun 24, 2021
@netlify
Copy link

netlify bot commented Jun 24, 2021

✔️ [V2]

🔨 Explore the source changes: 0feff47

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/60d4a9f4ade8510008f1aba6

😎 Browse the preview: https://deploy-preview-5052--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Jun 24, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 91
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5052--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Jun 24, 2021

Size Change: -40 B (0%)

Total Size: 571 kB

Filename Size Change
website/build/assets/js/main.********.js 386 kB -40 B (0%)
ℹ️ View Unchanged
Filename Size
website/build/assets/css/styles.********.css 87.7 kB
website/build/blog/2017/12/14/introducing-docusaurus/index.html 66.4 kB
website/build/docs/introduction/index.html 235 B
website/build/index.html 31.1 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. pr: new feature This PR adds a new API or behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow disabling or customizing the next version banner

2 participants