We should update the sidebar to support nested sub-sections inside groups, with expansion behavior based on the user’s current location in the docs.
Right now, the sidebar model appears to assume a fairly flat structure. That makes it difficult to represent documentation hierarchies where a category contains sub-sections, and those sub-sections may themselves contain additional nested pages or groups.
For example, consider a structure like this:
My Category
├── Overview
├── Getting Started
└── My Subsection
├── Intro
└── Advanced Usage
In this case, the sidebar should not treat My Category as a single flat group. Instead, it should allow My Subsection to behave as its own nested section within the parent group.
I believe the rules should be:
- If the user is on a page anywhere inside
My Category, that top-level category should appear expanded.
- If the user is on a page inside
My Subsection, then both My Category and My Subsection should appear expanded.
- Expansion should work recursively for deeper nesting levels, not just one level of children.
- The visible expanded state should be derived from the current page location, so users can clearly understand where they are in the hierarchy.
For example, if the current page is Advanced Usage, the visible sidebar state should effectively look like this:
My Category
├── Overview
├── Getting Started
└── My Subsection
├── Intro
└── Advanced Usage ← current page
This would let us model more complex information architectures without flattening everything into a single level, while also making navigation clearer and more intuitive for users.
We should update the sidebar to support nested sub-sections inside groups, with expansion behavior based on the user’s current location in the docs.
Right now, the sidebar model appears to assume a fairly flat structure. That makes it difficult to represent documentation hierarchies where a category contains sub-sections, and those sub-sections may themselves contain additional nested pages or groups.
For example, consider a structure like this:
In this case, the sidebar should not treat
My Categoryas a single flat group. Instead, it should allowMy Subsectionto behave as its own nested section within the parent group.I believe the rules should be:
My Category, that top-level category should appear expanded.My Subsection, then bothMy CategoryandMy Subsectionshould appear expanded.For example, if the current page is
Advanced Usage, the visible sidebar state should effectively look like this:This would let us model more complex information architectures without flattening everything into a single level, while also making navigation clearer and more intuitive for users.