Skip to content

Conflicting localized strings cause mixed up values for title and sidebar labels #916

@notlmn

Description

@notlmn

🐛 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

  1. Choose a value for id for a page
  2. Use the same value of id for sidebar_label as well
  3. Use a title that is not the same as id or sidebar_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": ""
    }
  }
}

Metadata

Metadata

Assignees

Labels

status: claimedIssue has been claimed by a contributor who plans to work on it.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions