facebook / facebook/docusaurus

Allow setting label for Versions Dropdown

Ouverte
#5,415 9 commentaires 3 réactions 0 personnes assignées Voir sur GitHub
domain: theme feature
Langage dominant
TypeScript
Étoiles
66.2k
Forks
10k
Merge moyen
1 j 3 h
PR mergées (30 j)
52

Description

## 🐛 Bug Report

### Prerequisites

- [x] I'm using the latest version of Docusaurus.
- [x] I have tried the `npm run clear` or `yarn clear` command.
- [x] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [x] I have tried creating a repro with https://new.docusaurus.io
- [x] I have read the console error message carefully (if applicable)

### Description

(A clear and concise description of what the bug is.)

### Have you read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues)?

Yup

## Steps to reproduce

Use https://new.docusaurus.io to create a CodeSandbox reproducible demo of the bug.

Versioning crashes CodeSandbox right now. Please use the example repo.

(Write your steps here:)

1. Create a project with multi-instance docs. Each set of documentation must be versioned. [Documentation is available here.](https://docusaurus.io/docs/docs-multi-instance)
1. Add a `docsVersionDropdown` navbar item for each set of docs as [shown here](https://docusaurus.io/docs/docs-multi-instance#docs-navbar-items)
1. Resize window to collapse navbar to sidebar

## Expected behavior
I expected the current version label to be moved to the sidebar.
(Write what you thought would happen.)

## Actual behavior
The word 'Version' replaces the label for the current (or any) version. In projects with multiple docs this creates a really confusing user experience for anyone using the site on mobile.
Screen Shot 2021-08-20 at 4 04 27 PM

[It turns out this value is hard coded in the classic theme.](https://github.com/facebook/docusaurus/blob/072a5a7e2edd59d93aa58cd6fb3a551a7c5d1df4/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx#L70)

Screen Shot 2021-08-20 at 4 05 17 PM

It would be great if I could override that label.

## Your environment

- Public source code: N/A
- Public site URL: N/A
- Docusaurus version used: 2.0.0-beta 4
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Chrome Version 92.0.4515.131, Node.js v15.5.1
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): MacOSX BigSur 11.4

## Reproducible demo
https://github.com/freef/docusaurus-error-example

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.