Skip to content

Version dropdown is not rendered when there is only next and some other version.  #3476

@maksnester

Description

@maksnester

🐛 Bug Report

Version dropdown has no dropdown.

Have you read the Contributing Guidelines on issues?

yes

To Reproduce

  1. Have only one /docs folder without versions
  2. Run yarn run docusaurus docs:version 1.x
  3. Add versions dropdown to the navbar
     {
          type: 'docsVersionDropdown',
          position: 'left',
        },

Expected behavior

Dropdown with 2 versions is visible in the navbar.

Actual Behavior

Only one 1.x version is visible.

Your Environment

2.0.0-alpha.64

Reproducible Demo

Sorry, maybe later. But the root of the problem is in theme-classic that has DocsVersionDropdownNavbar component where that code exists:

 // We don't want to render a version dropdown with 0 or 1 item
    // If we build the site with a single docs version (onlyIncludeVersions: ['1.0.0'])
    // We'd rather render a buttonb instead of a dropdown
    if (versions.length <= 2) {
      return undefined;
    }

The next version is a hidden version and doesn't count and it's not mentioned in versions.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionclosed: duplicateThis issue or pull request already exists in another issue or pull request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions