THE GITHTML FIELD GUIDE

Fix Docusaurus sidebar links that use the wrong document ID

Compare a Docusaurus sidebar entry with the document's actual ID, not merely its URL or visible title. Check explicit and autogenerated sidebar rules separately, including version-specific configuration. Repair the smallest mismatch, then verify the sidebar and direct route in a production build so a menu fix does not conceal a broader routing mistake.

Separate title, source path, identifier, and route

A page can have a friendly title, a source filename, a document identifier, and a public route that are related but not interchangeable. Start with the failed sidebar entry and identify which value it expects. Inspect front matter and plugin configuration that can affect identity or routing. Do not rename the source file until you understand incoming links and any versioned copies. Record the intended reading location: which category should contain the page and which neighboring pages help readers continue. A sidebar problem is partly a content-organization problem, not only a string mismatch in configuration.

Inspect explicit and generated structure independently

The sample shows a small explicit sidebar with illustrative document IDs. Compare this with the project's actual sidebar type. An autogenerated category may derive structure from directories and metadata, while explicit entries require the correct identifiers. Check spelling, case, path prefixes, and the relevant documentation plugin instance. If versioning is enabled, verify that you are editing the sidebar associated with the affected version. Avoid adding the same page in multiple places merely to make it visible somewhere. Duplicate navigation can confuse the active state and make it harder to understand which route is canonical for the reader's task.

js
export default {
  handbook: [
    'intro',
    { type: 'category', label: 'Reference', items: ['reference/configuration'] },
  ],
};

Verify navigation after the build

Run the local production build and follow the repaired sidebar entry from another page. Confirm that the intended page is selected and that its next or previous navigation remains sensible where used. Open the direct route as a separate check; a sidebar can point somewhere valid yet wrong. Review known links if you changed an identifier or source location. Keep a small authoring note explaining how this project assigns document IDs, especially when it differs from default conventions. The durable fix is a clear identity model and a reproducible check, not a one-off path adjustment that the next contributor must rediscover. When a sidebar includes an external URL, label that intent clearly. Otherwise a reviewer may spend time trying to resolve it as an internal document identifier or mistake it for a broken local entry.

  1. Identify the value expected by the sidebar and compare it with the actual document ID.
  2. Check front matter, plugin instance, and version scope before renaming files.
  3. Inspect explicit and autogenerated navigation rules separately.
  4. Follow the sidebar link and direct route in the local production output.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All documentation builds and formats guides →

Read as MarkdownAll guides

Fix Docusaurus sidebar links that use the wrong document ID · gitHtml