facebook / facebook/docusaurus

Allow setting label for Versions Dropdown

Đang mở
#5,415 9 bình luận 3 reaction 0 người được giao Xem trên GitHub
domain: theme feature
Ngôn ngữ chính
TypeScript
Star
66.2k
Fork
10k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
52

Mô tả

## 🐛 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.