Skip to main content

Sidebar Label and Redundancy Troubleshooting

This guide explains how we fixed the issue with folder names not appearing correctly in the sidebar and how to handle redundant names.


1. Fixing Stripped Number Prefixes

The Problem

Docusaurus automatically strips numbers like 01., 10., etc., from folder names when generating sidebar labels. It uses these numbers only for sorting.

The Solution: _category_.json

To force Docusaurus to show the full name (e.g., "10. Troubleshooting"), we created a _category_.json file inside the folder:

Path: /opt/docker-data/apps/docusaurus/site/docs/knowledge/docusaurus/10. Troubleshooting/_category_.json

{
"label": "10. Troubleshooting",
"position": 10,
"link": {
"type": "generated-index"
}
}

2. Removing Redundant Sidebar Items

The Problem

When you add an index.md to a category folder, Docusaurus creates a nested sidebar item with the same name as the category, which looks redundant.

The Solution: sidebar_class_name: hidden

We hidden the internal index.md from the sidebar while keeping the folder (category) visible. This is done by adding frontmatter to the index.md file:

Path: /opt/docker-data/apps/docusaurus/site/docs/knowledge/docusaurus/10. Troubleshooting/index.md

---
sidebar_class_name: hidden
---
# 10. Troubleshooting
...

3. Summary of Steps Taken

  1. Created _category_.json: To fix the label "10. Troubleshooting".
  2. Created index.md: To provide a landing page for the category.
  3. Updated index.md Frontmatter: Added sidebar_class_name: hidden to remove the redundant nested link in the sidebar.
  4. Restarted Service: Ran sudo docker restart docusaurus to apply changes.

Management Reference

ActionFileProperty
Change Folder Label_category_.json"label": "New Name"
Hide Item from Sidebar.md filesidebar_class_name: hidden
Reorder Category_category_.json"position": X