Skip to content

TOC does not work when importing one MDX into another #3915

@oriooctopus

Description

@oriooctopus

🐛 Bug Report

On our site we have a couple of duplicate doc pages. To avoid repeating content we have one doc as the source of truth then import the content like so:

import Content from './doc1.md';

<Content />

The issue is, the table of contents is not picked up on the pages that import the content. Please let me know if there is a better way to handle duplicate pages and if this usage is just conceptually wrong

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

npx @docusaurus/init@latest init my-website classic

in doc2:

import Content from './doc1.md';

<Content />

It's worth noting that this also happens on my 6 month old version, so I don't think that it's due to anything recent

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondifficulty: advancedIssues that are complex, e.g. large scoping for long-term maintainability.domain: markdownRelated to Markdown parsing or syntaxhelp wantedAsking for outside help and/or contributions to this particular issue or PR.status: accepting prThis issue has been accepted, and we are looking for community contributors to implement this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions