Sidebar
Understanding the sidebar
Last updated: July 1, 2025
The sidebar provides organized navigation for your documentation site with collapsible sections and active state management.
How It Works
The sidebar automatically generates navigation based on two sources:
1. Dynamic Content from Collections
- Reads all documents from the
docs
content collection - Groups documents by their
category
frontmatter field - Sorts documents within each category by their
order
field - Only displays categories defined in
categoryConfig
2. Static Links
- Hardcoded links that appear at the bottom of the navigation
- Always visible regardless of category configuration
Adding or Removing Document Categories
To Add a New Category
- Add to categoryConfig: Edit the
categoryConfig
object in your sidebar component:
const categoryConfig = {
"getting-started": { name: "Getting Started", order: 1 },
"components": { name: "Components", order: 2 },
"examples": { name: "Examples", order: 3 },
"new-category": { name: "My New Section", order: 4 }, // Add this line
"help": { name: "Help & Support", order: 5 },
};
- Create documents: Create markdown files in your
src/content/docs/
folder with the matching category:
---
title: "My New Document"
category: "new-category" # Must match the key in categoryConfig
order: 1
---
Content here...
To Remove a Category
Simply remove or comment out the category from categoryConfig
:
const categoryConfig = {
"getting-started": { name: "Getting Started", order: 1 },
"components": { name: "Components", order: 2 },
// "examples": { name: "Examples", order: 3 }, // Removed
"help": { name: "Help & Support", order: 4 },
};
Documents with the removed category will be automatically filtered out and wonβt appear in the sidebar.
Adding or Removing Static Links
Edit the staticLinks
array at the top of the sidebar component:
const staticLinks = [
{ href: "/integrations", title: "Integrations" },
{ href: "/changelog", title: "Changelog" },
{ href: "/infopages/licensing", title: "Licensing" },
{ href: "/new-page", title: "New Page" }, // Add new link
];
To remove a static link, simply delete or comment out the corresponding line.
Document Ordering
Within Categories
Documents are sorted by their order
frontmatter field:
---
title: "First Document"
category: "guides"
order: 1 # Will appear first
---
---
title: "Second Document"
category: "guides"
order: 2 # Will appear second
---
Category Ordering
Categories are sorted by the order
value in categoryConfig
:
const categoryConfig = {
"getting-started": { name: "Getting Started", order: 1 }, // First
"components": { name: "Components", order: 2 }, // Second
"help": { name: "Help & Support", order: 3 }, // Third
};
Active States
The sidebar automatically highlights:
- Active category sections: When viewing a document from that category
- Active document links: When viewing that specific document
- Active static links: When on that specific page
This is handled automatically based on the current URL path.
Accordion Behavior
- Only one category section can be open at a time
- Clicking a category header toggles that section
- The active category (containing the current page) opens automatically
- Smooth animations for expand/collapse transitions
Special Category Handling
Some categories have special behavior in the SidebarLinks
component:
- Integrations: Shows a βView Integrationsβ link
- Changelog: Shows a βView Changelogβ link
These are hardcoded in the SidebarLinks.astro
component and will need manual updates if you rename these categories.
File Structure
src/
βββ content/
β βββ docs/
β βββ getting-started/
β β βββ installation.md
β β βββ quick-start.md
β βββ components/
β β βββ buttons.md
β β βββ forms.md
β βββ help/
β βββ faq.md
βββ components/
βββ global/
βββ navigation/
βββ Sidebar.astro # Main sidebar component
βββ SidebarLinks.astro # Individual category sections
Troubleshooting
Links Not Clickable
If accordion buttons become unclickable, ensure:
- Only one accordion script is running (remove script from
SidebarLinks.astro
if present) - The main sidebar script has proper event listener initialization
- All required CSS classes are present
Category Not Showing
If a category doesnβt appear:
- Check that itβs defined in
categoryConfig
- Verify documents have the correct
category
frontmatter - Ensure the category key matches exactly (case-sensitive)
Wrong Order
If items appear in the wrong order:
- Check
order
values in document frontmatter - Verify
order
values incategoryConfig
- Remember that lower numbers appear first