Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labels do not have unique translation keys #10913

Open
6 of 7 tasks
mike-solomon opened this issue Feb 6, 2025 · 0 comments
Open
6 of 7 tasks

Labels do not have unique translation keys #10913

mike-solomon opened this issue Feb 6, 2025 · 0 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@mike-solomon
Copy link

mike-solomon commented Feb 6, 2025

Have you read the Contributing Guidelines on issues?

Prerequisites

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

Description

In the sidebars.ts file, if you give multiple objects the same label (e.g., "How-to guides"), they will not generate unique translation keys. This means that the description field on those objects will not work as one of the objects will clobber all of the other ones.

As an example, let's say I want my site to look like this:

Topic A
  Getting Started
    ...
  How to guides
    ...
  References
    ...
Topic B
  Getting Started
    ...
  How to guides
    ...
  References
    ...

In my sidebars.ts file, I figured I could do something like this:

type: 'category',
label: 'References',
link: {
  type: 'generated-index',
  title: 'References',
  description: 'Moderne DX reference docs.',
  slug: '/administrator-documentation/moderne-dx/references',
  keywords: ['reference'],
},

and

type: 'category',
label: 'References',
link: {
  type: 'generated-index',
  title: 'References',
  description: 'Moderne Platform reference docs.',
  slug: '/administrator-documentation/moderne-platform/references',
  keywords: ['reference'],
},

However, that will result in one of the categories not having the correct description:

Image

Image

Related information here: #10906 (comment)

Reproducible demo

https://github.com/mike-solomon/docusaurus-testing/tree/main/website

Steps to reproduce

  1. Launch the side.
  2. Navigate to foo/how-to.
  3. Notice that it has the description for the bar/how-to page.

Expected behavior

I would expect the descriptions on the category pages to match what I wrote in the sidebars.ts file.

Actual behavior

One or more of my pages descriptions gets clobbered with the incorrect description.

Your environment

Self-service

  • I'd be willing to fix this bug myself.
@mike-solomon mike-solomon added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Feb 6, 2025
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

No branches or pull requests

2 participants