Skip to content

Sidebar Configuration Practical Guide

This guide will walk you through how to configure and manage CrychicDoc's sidebar through a series of common tasks.

Core Concept: Frontmatter-Driven Configuration

CrychicDoc's sidebar system automatically generates configuration by reading the frontmatter you set in Markdown files. You only need to declare metadata (like title, priority) in documents, then run a script, and the sidebar will automatically update.

Core Configuration Fields

To effectively manage the sidebar, you need to understand the following key frontmatter fields.

Field Type Description
root boolean Mark a directory's sidebarIndex.md as a new root node in the sidebar.
title string Required. Title displayed in the sidebar.
priority number Required. Sort weight, smaller numbers appear first.
maxDepth number Controls how deep the current directory view expands downward.
hidden boolean If true, this page or directory will not appear in the sidebar.
externalLinks object[] Add links to external websites in root nodes.
useChildrenCollapsed object Controls only how child directory items appear in the current generated tree, without rewriting child frontmatter.

Practical Tutorial: Configuring a New Documentation Area

Advanced Tips

Add externalLinks in the frontmatter of the root directory AwesomeMod/sidebarIndex.md.

yaml
---
root: true
title: "AwesomeMod Guide"
# ... other configurations ...
externalLinks:
  - text: "Official Wiki"
    link: "https://awesomemod.com/wiki"
    priority: -999 # Use negative numbers to make links appear first
  - text: "GitHub Repository"
    link: "https://github.com/user/awesomemod"
    priority: -1000
---

Using useChildrenCollapsed for Current-Tree Folding

If your real goal is just to decide how child directory items appear in the current sidebar tree, use useChildrenCollapsed.

useChildrenCollapsed Field Contract

Field path Type Default behavior Effect
useChildrenCollapsed object omitted means "keep each child item's own collapsed value" Current-tree child folding rule.
useChildrenCollapsed.mode "children" | "self" | "collapsed" | "open" children Keep each child as-is, follow the current directory, force collapsed, or force open.
useChildrenCollapsed.depth number 1 Affects how many descendant levels inherit the rule.

This only affects how directory items appear in the current generated sidebar tree:

  • it does not rewrite a child directory's own collapsed;
  • it does not rewrite a child directory's own maxDepth;
  • it does not rewrite child document frontmatter;
  • it does not take over traversal ownership.

Minimal example:

yaml
---
root: true
title: "Modpack"
useChildrenCollapsed:
  mode: collapsed
  depth: 1
---

This keeps the authoring model simple: direct child directory items in this tree start collapsed.

If you want descendants to follow the current directory's own collapsed value:

yaml
---
root: true
collapsed: true
useChildrenCollapsed:
  mode: self
  depth: 2
---

That makes children and grandchildren in the current tree follow the current directory state.

Directory Landing File Rules

When a directory needs a clickable landing page, the system looks for these files in order:

  • index.md
  • Catalogue.md
  • README.md

This keeps first-party sections free to use Catalogue.md, while mirrored third-party docs can rely on their existing README.md instead of carrying an extra Catalogue.md.