Skip to content

Docs plugin - possible conflict between docs files with similar names #11136

Closed

Description

@xt8288

Have you read the Contributing Guidelines on issues?

Description

Hello, currently the framework is functioning smoothly. However, we've encountered an issue. Once a Markdown document starts with a number, a default URL is generated. For example, if the document names are "8 - aaa - test" and "6 - aaa - hello", there are also differences in the slug within the document. After previewing, the system will recognize them as one document. Has anyone encountered a similar problem and know how to solve it?

Self-service

  • I'd be willing to address this documentation request myself.

Activity

  1. added
    documentation
    status: needs triage
    on Apr 29, 2025
  2. slorber commented on May 2, 2025

    @slorber
    Collaborator

    Please create a https://docusaurus.new runnable repro using our bug report template.

  3. added
    bug
    and removed
    documentation
    status: needs triage
    on May 6, 2025
  4. slorber commented on May 6, 2025

    @slorber
    Collaborator

    Thanks, I confirm something weird is happening

  5. reopened this on May 6, 2025
  6. xt8288 commented on May 6, 2025

    @xt8288
    Author

    Thank you very much for your prompt reply. If this issue is fixed or you have any solutions, please let me know again. Since the local files I have were set up a year ago and may not be the latest version, it will be convenient for me to update my local files. Thank you again.

  7. changed the title [-]Regarding the command - style issues of Markdown documents.[/-] [+]Docs plugin - possible conflict between docs files with similar names[/+] on May 15, 2025
  8. slorber commented on Jun 2, 2025

    @slorber
    Collaborator

    So, the problem is that both documents within the same directory gets assigned the same id

    The logic looks like this:

    const baseID: string = frontMatter.id ?? unprefixedFileName;
    const id = [computeDirNameIdPrefix(), baseID].filter(Boolean).join('/');

    The number prefix is not taken into consideration when computing the document id from its file system location.

    To prevent such unexpected conflicts, I will add an error message when this happens and recommend that users provide an explicitly distinct front matter ID.


    Really curious though: what's the reason you want to use the same name for both files, and only change the number prefix? Do you have a good use case for this?

  9. eMUQI commented on Feb 11, 2026

    @eMUQI

    Really curious though: what's the reason you want to use the same name for both files, and only change the number prefix? Do you have a good use case for this?

    @slorber

    We can imagine a scenario like this: suppose there are two screen products of different sizes, such as a 4-inch screen and a 5-inch screen. When writing documentation, if the files are named 4-inch-display.md and 5-inch-display.md respectively, the generated IDs would be duplicated.

  10. slorber commented on Feb 12, 2026

    @slorber
    Collaborator

    I see thanks

    In this case, the intention is not to use the "number prefix" as a way to order the sidebar, because the name of the doc contains that number.

    In that case, maybe it's better to use display-4-inch.md, or four-inch-display.md

    We also have options to opt out / customize the parsing of number prefixes on a case-by-case basis:

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions