-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
🐛 Bug Report
Docusaurus uses the same object to have localized strings of both title and sidebar_label of a page, using id as key that maps to title of that page. This is fine in most cases, but if the id and sidebar_label of a page are the same then the keys conflict, causing both of them to mix up.
This leads to behavior like #324. This gets even weirder when the same values are used across different versions of the docs, where the sidebar_label of the versioned doc gets mixed up with the title of latest doc.
Have you read the Contributing Guidelines on issues?
Yes I did.
To Reproduce
- Choose a value for
idfor a page - Use the same value of
idforsidebar_labelas well - Use a
titlethat is not the same asidorsidebar_label
Expected behavior
The title of the page and label on the sidebar are expected to be different.
Actual Behavior
The title of the page is the value of sidebar label instead of its actual one.
Reproducible Demo
Sample repo that contains same values for id and sidebar_label, with a different title, and across different versions.
After building the docs and running docusaurus-start, navigate to /docs/en/feature-awesome. Here the sidebar label should be feature-awesome, instead it is feature/awesome which is the title of latest doc with the same.
Proposed solution
Use different keys for titles, sidebar_labels, across different versions of the same page.
{
"localized-strings": {
"versioned-page-id": {
"title": "",
"sidebar_label": ""
}
}
}