Editorial Navigation
Advanced recipe for grouping existing pages into a different sidebar hierarchy without changing their URLs.
Advanced
Start with filesystem navigation. If you can move the files so that their directories match the sidebar you want, do that instead. This recipe replaces the header and sidebar chrome with host code that you then maintain.
When You Need It
Use an editorial tree when existing URLs must stay where they are but the sidebar needs a different parent/child structure. Typical cases:
Articles that are siblings of their intended landing page on disk, for example
reference/installationnext toreference/basics.A collection that includes a page from another section, such as a guide listed under Reference.
A large flat directory that readers should browse through real landing pages.
You do not need this recipe for these cases:
| You want | Use |
|---|---|
| The same hierarchy as your directories | Filesystem navigation with an authored index.mdx per category |
| A label with no landing page above some pages | category_no_page: true, or a synthetic type: "category" item (Sidebar) |
| A section's linked child groups shown one level shallower | initialPath on the filesystem tree (Sidebar) |
| Several complete sections under one linked landing page | The umbrella tree below, which keeps every native descendant |
A synthetic type: "category" item cannot produce linked parent rows. It never has an href, so a landing page placed inside it appears as an extra child below an unlinked heading. SidebarCategory has no property that links its heading to a page.
Six Separate Decisions
Navigation looks like one tree, but it combines six decisions. This recipe changes only the second one.
| Decision | Default source | In this example |
|---|---|---|
| 1. Which pages and URLs exist | Content files (and slug frontmatter) | Unchanged |
| 2. Which pages are parents and children in the sidebar | Directory structure | The editorialMembers map |
| 3. Which section owns a destination page | The page URL, matched by headerNav categoryMatch | Unchanged: the URL owner |
| 4. Which part of the tree is initially visible | initialPath and initialPathMode | The Reference row and its children |
| 5. Which branches are expanded | sidebar_initial_expansion, collapsed, and the reader's toggles | Unchanged |
| 6. How far Broaden tree may travel | The supplied forest and scopeRoot | The one-root Reference forest |
The Example
Content Files and URLs
The example site has two header sections. Every page that becomes an editorial row has an authored page.
src/content/docs/
├── guides/
│ ├── index.mdx → /docs/guides/ "Guides"
│ └── deploying.mdx → /docs/guides/deploying/ "Deploying"
└── reference/
├── index.mdx → /docs/reference/ "Reference"
├── basics.mdx → /docs/reference/basics/ "Basics"
├── installation.mdx → /docs/reference/installation/
└── configuration.mdx → /docs/reference/configuration/ On disk, Basics, Installation, and Configuration are siblings. The default Reference sidebar is therefore flat:
Reference (linked)
├── Basics (linked)
├── Installation (linked)
└── Configuration (linked)The wanted Reference sidebar keeps every URL but changes the parents:
Reference (linked) /docs/reference/
├── Basics (linked) /docs/reference/basics/
│ ├── Installation (linked) /docs/reference/installation/
│ └── Configuration (linked) /docs/reference/configuration/
└── Deploying (linked) /docs/guides/deploying/ ← cross-section leaf Membership Data and Tree Helper
The membership map is the only description of the editorial hierarchy. The helper receives the native tree, finds the real nodes by slug, and returns copies whose children are exactly their members. Labels, hrefs (with locale and base), and metadata are taken from the native nodes, so nothing is reconstructed by hand.
import type { DocNavNode } from "@takazudo/zudo-doc/doc-page-props";
import type { SidebarDefinition } from "@takazudo/zudo-doc/sidebar-utils";
/** The header section (`categoryMatch`) that renders the editorial tree. */
export const EDITORIAL_SECTION = "reference";
/** Editorial parent slug → ordered child slugs. Page URLs do not change. */
export const editorialMembers: ReadonlyMap<string, readonly string[]> = new Map([
["reference", ["reference/basics", "guides/deploying"]],
["reference/basics", ["reference/installation", "reference/configuration"]],
]);
/** The forest has one root, Reference; `[0]` in node mode shows that row. */
export const editorialSidebar: SidebarDefinition = {
items: [{ type: "autogenerated" }],
initialPath: [0],
initialPathMode: "node",
};
/**
* Rebuild the native tree as a one-root editorial forest. Every row is a
* shallow copy of a native node (label, href, metadata); its children are
* exactly its editorial members, so a cross-link stays a leaf. The input
* is not mutated.
*/
export function toEditorialTree(tree: DocNavNode[]): DocNavNode[] {
const bySlug = new Map<string, DocNavNode>();
const index = (nodes: DocNavNode[]): void => {
for (const node of nodes) {
bySlug.set(node.slug, node);
index(node.children);
}
};
index(tree);
const build = (slug: string, ancestors: readonly string[]): DocNavNode[] => {
const node = bySlug.get(slug);
// A page missing from this locale or version tree is skipped, not invented.
if (!node) return [];
if (!node.hasPage || !node.href) {
throw new Error(`Editorial row "${slug}" needs an authored page`);
}
if (ancestors.includes(slug)) throw new Error(`Editorial cycle at "${slug}"`);
const members = editorialMembers.get(slug) ?? [];
const path = [...ancestors, slug];
return [{ ...node, children: members.flatMap((member) => build(member, path)) }];
};
const forest = build(EDITORIAL_SECTION, []);
// Without the root page (for example in an older version), keep the native tree.
return forest.length > 0 ? forest : tree;
}A row that has no editorialMembers entry of its own (such as guides/deploying here) is a leaf in the editorial tree even if it has native children. That keeps a cross-link from importing its whole original section. Conversely, a page that is not listed anywhere is omitted from the editorial sidebar and drawer: when you add a page to the section, add it to editorialMembers too. It is still routed and still appears in the pager.
Paired Header and Sidebar
The package Header and Sidebar factories read their tree through buildNavTree on the context they receive. The wrapper creates one context that forwards every original argument to the native buildNavTree and transforms only the result. The same context feeds both factories, so the desktop sidebar and the mobile drawer receive identical data. Every other section uses a second, unmodified pair.
import type { HeaderSlotProps, SidebarSlotProps } from "@takazudo/zudo-doc/chrome-bindings";
import type {
ChromeContext,
ChromeHostBindings,
RouteContext,
} from "@takazudo/zudo-doc/factory-context";
import { createHeaderWithDefaults } from "@takazudo/zudo-doc/header-with-defaults";
import { createSidebarWithDefaults } from "@takazudo/zudo-doc/sidebar-with-defaults";
import { EDITORIAL_SECTION, editorialSidebar, toEditorialTree } from "./editorial-tree";
/**
* Header and Sidebar replacements: Reference pages get the editorial tree,
* every other section keeps the native tree. Each pair shares one context,
* so the desktop sidebar and the mobile drawer receive the same data.
*/
export function createEditorialChrome(routeCtx: RouteContext, bindings: ChromeHostBindings) {
const nativeContext: ChromeContext = { ...routeCtx, components: {}, hostBindings: bindings };
const editorialContext: ChromeContext = {
...nativeContext,
hostBindings: {
...bindings,
sidebarsConfig: { ...bindings.sidebarsConfig, [EDITORIAL_SECTION]: editorialSidebar },
},
// Forward every argument so locale, base and href building stay native.
buildNavTree: (...args) => toEditorialTree(routeCtx.buildNavTree(...args)),
};
const native = {
Header: createHeaderWithDefaults(nativeContext),
Sidebar: createSidebarWithDefaults(nativeContext),
};
const editorial = {
Header: createHeaderWithDefaults(editorialContext),
Sidebar: createSidebarWithDefaults(editorialContext),
};
const pairFor = (navSection: string | undefined) =>
navSection === EDITORIAL_SECTION ? editorial : native;
return {
Header: (props: HeaderSlotProps) => pairFor(props.navSection).Header(props),
Sidebar: (props: SidebarSlotProps) => pairFor(props.navSection).Sidebar(props),
};
}The wrappers pass every prop through unchanged, including lang, currentSlug, currentPath, and currentVersion. Versioned pages therefore keep their / hrefs, because the package remaps the copied native nodes by slug after the tree is built.
Registering the Bindings
The chrome bindings module builds its own route context from the same serializable payload the document routes use, and registers the two wrappers with defineChromeBindings. Keep every binding your project already has in baseBindings; the wrappers reuse them unchanged.
import { routeContext } from "virtual:zudo-doc-route-context";
import { createRouteContext, type RouteContextPayload } from "@takazudo/zudo-doc/route-context";
import { defineChromeBindings } from "@takazudo/zudo-doc/chrome-bindings";
import { createEditorialChrome } from "./navigation/editorial-chrome";
// The project's other bindings. The editorial chrome reuses them unchanged.
const baseBindings = defineChromeBindings({
sidebarsConfig: {
guides: { items: [], scopeRoot: "configured" },
},
});
const routeCtx = createRouteContext(routeContext as unknown as RouteContextPayload);
export const chromeBindings = {
...baseBindings,
...defineChromeBindings(createEditorialChrome(routeCtx, baseBindings)),
};The Guides entry in baseBindings is an ordinary fallback section: Guides pages keep the native tree, capped at the Guides section.
Because both pairs replace the package Header, slots that the package would otherwise add on its own routes must also be in baseBindings. In particular, a project that sets designTokenPanel: true together with designTokenPanelConfigModule should bind its DesignTokenPanelBootstrap boundary there, or the header loses the panel toggle.
Configuration
Point chromeBindingsModule at the module and give each header item a single-segment categoryMatch:
import { defineConfig } from "zfb/config";
import { zudoDoc } from "@takazudo/zudo-doc/config";
export default defineConfig(
zudoDoc({
siteName: "Acme Docs",
headerNav: [
{ label: "Guides", path: "/docs/guides", categoryMatch: "guides" },
{ label: "Reference", path: "/docs/reference", categoryMatch: "reference" },
],
chromeBindingsModule: "./src/chrome-bindings.tsx",
}),
);No other files change. The document routes already pass chromeBindings to the chrome.
What Stays Native
Only the two wrapped factories see the editorial tree. Everything else keeps reading the original route context:
Breadcrumbs follow URL segments, so Installation shows Reference › Installation, not Basics.
Previous/next pager, search, and the sitemap keep URL order.
<CategoryNav>reads the URL tree (see the next section).The sidebar renderer is the native one. Filtering, disclosure, the focus frame, Broaden tree, Restore, saved state, focus handling, and accessibility behave as on any other site.
Every Reference page renders the same editorial forest with the same baseline, so they share one navigation context: a reader who focuses a branch on Installation still sees that branch on Configuration. Guides pages use the native context.
Landing Pages and CategoryNav
<CategoryNav category="reference" /> lists the children of reference in the URL tree. Here that would show Basics, Installation, and Configuration as peers, and it would omit Deploying. CategoryNav cards and the chrome-only editorial tree are separate consumers of navigation data.
On a landing page whose editorial children differ from its directory children, write the list in the same order as editorialMembers and update both together:
---
title: Reference
sidebar_position: 2
---
Settings, commands, and deployment notes.
- [Basics](./basics.mdx)
- [Deploying](../guides/deploying.mdx)basics.mdx lists Installation and Configuration the same way. Landing pages whose children match their directory can keep using <CategoryNav>.
Destination Ownership
Sidebar membership does not change which section owns a page. Deploying appears in the Reference sidebar, but its URL is /, which matches the Guides categoryMatch. When a reader follows that link, the Guides header item becomes active and the page renders the Guides sidebar.
That is the policy this example chooses: the URL owns the destination. Making Reference own the page would be a separate host decision. Your wrappers would have to select a different section for those slugs, and you would need to check the header state and the sidebar of every affected page. The package does not do this automatically.
Example Constraints
Authored landing pages. Every editorial row must have an authored page (
hasPageand anhref). The helper throws for a generated auto-index row or acategory_no_pageheading. With versioning enabled, the header's version switcher also builds this tree for every configured version, so keep the editorial section free of generated auto-index routes in archived versions too; an editorial row that is an auto-index in an older version fails the build.Missing pages. A member missing from a locale or version tree is skipped. If the root page is missing, the helper returns the native tree.
One editorial section. Membership is keyed by slug, so the same data covers every locale and version. For several editorial sections, give each section its own root and choose the pair by
navSectionin the same way.
Scope Inside the Editorial Forest
The supplied forest is [Reference], so its indexes describe that forest and not URL segments:
[0] Reference
[0, 0] Basics
[0, 1] Deploying{ items: [{ type: "autogenerated" }], initialPath: [0], initialPathMode: "node" } selects the Reference row itself, with its children. Because the forest has only one root, that baseline is already the highest scope, so the scope toolbar stays hidden until the reader focuses a branch.
To start Installation and Configuration at Basics instead, a page would need initialPath: [0, 0] with node mode. That means choosing a different sidebar definition per page and creating a separate factory pair for each definition. Keep one baseline unless readers clearly need more.
Do not use { type: "autogenerated", dirName: "reference" } here. It shows the children of Reference and hides the Reference row, so [0] would select Basics.
Checking the Tree
Test the helper against your real tree before you ship it. Build the native tree for each locale, call toEditorialTree, and assert the parent of each member and the order of the children. Also assert that every native page of the section is reachable in the result. A typo in editorialMembers, or a new page that was never listed, drops a page silently.
Umbrella Tree with Complete Sections
The example above is a curated tree: it lists particular pages, and a cross-link stays a leaf. An umbrella tree is a different pattern. One linked landing page becomes the parent of several complete sections, and each section keeps all of its native pages and groups. This showcase's Learn sidebar is an umbrella tree.
The Tree to Build
Write the wanted tree down before choosing any configuration:
Learn (linked) /docs/learn/
├── Guides (linked) /docs/guides/ + every native descendant
├── Components (linked) /docs/components/ + every native descendant
└── Markdown Features (linked) /docs/markdown-features/ + every native descendant Then state each decision separately:
| Decision | Learn umbrella |
|---|---|
| Parent/child hierarchy | Learn is the only root. Its children are the three linked section rows, each with its complete native subtree. Nothing else is authored |
| Destination ownership | Unchanged: each page belongs to the section its URL matches (learn, guides, components, or markdown-features). All four sections select the same shared Learn forest |
| Fresh and Restore view | The Learn landing page starts at the Learn row. A Guides, Components, or Markdown Features page starts at its own section row |
| Disclosure | The Learn landing page sets sidebar_initial_expansion: collapsed, so its three branches start closed. Section pages keep their native expansion, and the current page's ancestors open as usual |
| Broadening ceiling | Learn. Broaden tree on a section reaches Learn and stops there |
| Saved reader state | Native. The four sections share one navigation context, so a reader's broader Learn view or focused branch survives navigation between them until Restore |
Why a List of Section Pages Is Not Enough
The flat configuration below looks like a hierarchy but produces four peer links:
learn: {
items: ["learn", "guides", "components", "markdown-features"],
scopeRoot: "configured",
},Learn (linked, leaf)
Guides (linked, leaf)
Components (linked, leaf)
Markdown Features (linked, leaf)A string or type: "doc" item selects one page and drops its children. scopeRoot only limits how far Broaden tree can travel, and initialPath only selects which part of the existing tree is shown. Neither creates a parent. A header dropdown that lists the sections does not create one either; see Header Navigation.
Umbrella Tree Helper
Only the root slug and the ordered branch slugs are authored. The helper finds the real native nodes by slug, copies the root row, and attaches the native branch nodes unchanged, so their descendants, labels, hrefs, and metadata stay native. Pages that live directly under the root's own directory stay its children too, ahead of the branches. A page or nested group added anywhere inside a branch appears without editing this list.
import type { DocNavNode } from "@takazudo/zudo-doc/doc-page-props";
import type { SidebarDefinition } from "@takazudo/zudo-doc/sidebar-utils";
/**
* A linked umbrella row that holds complete native sections. Only the direct
* branch memberships and their order are authored; everything below a branch
* comes from the native tree.
*/
export interface UmbrellaNavigation {
/** Slug of the umbrella landing page, also its header `categoryMatch`. */
root: string;
/** Ordered branch slugs, each also its own section's `categoryMatch`. */
branches: readonly string[];
}
export const learnNavigation: UmbrellaNavigation = {
root: "learn",
branches: ["guides", "components", "markdown-features"],
};
/** Header sections that render the umbrella forest. */
export function umbrellaSections(umbrella: UmbrellaNavigation): string[] {
return [umbrella.root, ...umbrella.branches];
}
/**
* The one-root umbrella forest: a copy of the native root row. Its own native
* pages come first, then the native branch nodes, descendants included.
* Branches missing from this locale or version are skipped. Without a linked
* root page the result is `undefined`, so callers keep the fully native
* navigation. The input is not mutated.
*/
export function toUmbrellaTree(tree: DocNavNode[], umbrella: UmbrellaNavigation): DocNavNode[] | undefined {
const bySlug = new Map<string, DocNavNode>();
const index = (nodes: DocNavNode[]): void => {
for (const node of nodes) {
if (!bySlug.has(node.slug)) bySlug.set(node.slug, node);
index(node.children);
}
};
index(tree);
const root = bySlug.get(umbrella.root);
if (!root?.hasPage || !root.href) return undefined;
const branches = umbrella.branches.flatMap((slug) => {
const branch = bySlug.get(slug);
return branch ? [branch] : [];
});
const own = root.children.filter((node) => !umbrella.branches.includes(node.slug));
return [{ ...root, children: [...own, ...branches] }];
}
/**
* Node-mode baseline for one section of an umbrella forest: the root row for
* the umbrella itself, otherwise the section's actual branch row. Returns
* `undefined` when the section is not a retained branch.
*/
export function umbrellaSidebar(forest: readonly DocNavNode[], section: string): SidebarDefinition | undefined {
const root = forest[0];
if (!root) return undefined;
const branch = root.children.findIndex((node) => node.slug === section);
const initialPath = section === root.slug ? [0] : branch >= 0 ? [0, branch] : undefined;
if (!initialPath) return undefined;
return {
items: [{ type: "autogenerated" }],
initialPath,
initialPathMode: "node",
scopeRoot: "configured",
};
}Unlike toEditorialTree, this helper never prunes a branch's children, and it never throws for a generated index. Use the curated helper when the sidebar should list particular pages, and the umbrella helper when it should hold complete sections.
Umbrella Header and Sidebar
Every section of the umbrella renders the same one-root forest. Only the node-mode initialPath differs, and it is taken from the branches that are actually present, never from a fixed index. The wrapper builds one factory pair per baseline and gives the Header and the Sidebar the same context, so the mobile drawer and the desktop sidebar always agree.
import type { HeaderSlotProps, SidebarSlotProps } from "@takazudo/zudo-doc/chrome-bindings";
import type { DocPageEntry } from "@takazudo/zudo-doc/doc-page-props";
import type {
ChromeContext,
ChromeHostBindings,
RouteContext,
} from "@takazudo/zudo-doc/factory-context";
import { createHeaderWithDefaults } from "@takazudo/zudo-doc/header-with-defaults";
import { createSidebarWithDefaults } from "@takazudo/zudo-doc/sidebar-with-defaults";
import type { SidebarDefinition } from "@takazudo/zudo-doc/sidebar-utils";
import {
toUmbrellaTree,
umbrellaSections,
umbrellaSidebar,
type UmbrellaNavigation,
} from "./learn-navigation";
interface ChromePair {
Header: ReturnType<typeof createHeaderWithDefaults>;
Sidebar: ReturnType<typeof createSidebarWithDefaults>;
}
const pairOf = (context: ChromeContext): ChromePair => ({
Header: createHeaderWithDefaults(context),
Sidebar: createSidebarWithDefaults(context),
});
/**
* Header and Sidebar replacements for umbrella sections. Every section of an
* umbrella renders the same one-root forest; only its node-mode baseline
* differs. A locale or version without the umbrella's root page, and every
* other section, keeps the native pair with its original sidebar definitions.
* Each pair shares one context, so the desktop sidebar and the mobile drawer
* receive the same data.
*/
export function createUmbrellaChrome(
routeCtx: RouteContext,
bindings: ChromeHostBindings,
umbrellas: readonly UmbrellaNavigation[],
) {
const nativeContext: ChromeContext = { ...routeCtx, components: {}, hostBindings: bindings };
const native = pairOf(nativeContext);
const pairs = new Map<string, ChromePair>();
// navDocs keeps its identity until content changes, so one decision serves
// the Header and Sidebar of every page that shares a source.
const decisions = new WeakMap<object, Map<string, SidebarDefinition | undefined>>();
function definitionFor(
umbrella: UmbrellaNavigation,
navSection: string,
lang: string,
currentVersion: string | undefined,
): SidebarDefinition | undefined {
// Decide from the same native source and tree the factories render.
const { navDocs, categoryMeta } = routeCtx.loadNavSourceDocs(lang, currentVersion);
let byKey = decisions.get(navDocs);
if (!byKey) decisions.set(navDocs, (byKey = new Map()));
const key = `${lang}\n${navSection}`;
if (!byKey.has(key)) {
const tree = routeCtx.buildNavTree(
navDocs as DocPageEntry[],
lang,
categoryMeta,
(slug, locale) => routeCtx.docsUrl(slug, locale),
);
const forest = toUmbrellaTree(tree, umbrella);
byKey.set(key, forest && umbrellaSidebar(forest, navSection));
}
return byKey.get(key);
}
function pairFor(lang: string, navSection: string | undefined, currentVersion: string | undefined): ChromePair {
if (navSection === undefined) return native;
const umbrella = umbrellas.find((candidate) => umbrellaSections(candidate).includes(navSection));
const definition = umbrella && definitionFor(umbrella, navSection, lang, currentVersion);
if (!umbrella || !definition) return native;
const key = `${navSection}:${definition.initialPath?.join(".")}`;
let pair = pairs.get(key);
if (!pair) {
pair = pairOf({
...nativeContext,
hostBindings: {
...bindings,
sidebarsConfig: { ...bindings.sidebarsConfig, [navSection]: definition },
},
// Forward every argument so locale, base and href building stay native.
buildNavTree: (...args) => {
const nativeTree = routeCtx.buildNavTree(...args);
return toUmbrellaTree(nativeTree, umbrella) ?? nativeTree;
},
});
pairs.set(key, pair);
}
return pair;
}
return {
Header: (props: HeaderSlotProps) => pairFor(props.lang, props.navSection, props.currentVersion).Header(props),
Sidebar: (props: SidebarSlotProps) => pairFor(props.lang, props.navSection, props.currentVersion).Sidebar(props),
};
}When the effective locale or version has no linked root page, toUmbrellaTree returns undefined and the wrapper uses the native pair with the project's original sidebar definitions. It does not keep the umbrella's initialPath against the native tree, invent a root route, or link to missing pages. If a branch is missing, the other branches keep their own rows and that section falls back to the native pair.
Registering the Umbrella Bindings
import { routeContext } from "virtual:zudo-doc-route-context";
import { createRouteContext, type RouteContextPayload } from "@takazudo/zudo-doc/route-context";
import { defineChromeBindings } from "@takazudo/zudo-doc/chrome-bindings";
import type { SidebarDefinition } from "@takazudo/zudo-doc/sidebar-utils";
import { createUmbrellaChrome } from "./lib/learn-chrome";
import { learnNavigation } from "./lib/learn-navigation";
// Native fallback definitions, used where a locale or version has no Learn page.
const section = (): SidebarDefinition => ({ items: [], scopeRoot: "configured" });
// The project's other bindings. The umbrella chrome reuses them unchanged.
const baseBindings = defineChromeBindings({
sidebarsConfig: {
learn: section(),
guides: section(),
components: section(),
"markdown-features": section(),
reference: section(),
},
});
export const chromeBindings = {
...baseBindings,
...defineChromeBindings(
createUmbrellaChrome(
createRouteContext(routeContext as unknown as RouteContextPayload),
baseBindings,
[learnNavigation],
),
),
};The same caveat as the curated recipe applies: because both factories replace the package Header, a project that binds a custom DesignTokenPanelBootstrap (with designTokenPanelConfigModule) must keep that binding in baseBindings. The default panel configuration needs nothing extra.
Keep each section's own categoryMatch. The header already marks the Learn dropdown active for its children and highlights the matching child; giving every route learn as its section would lose that child state.
import { defineConfig } from "zfb/config";
import { zudoDoc } from "@takazudo/zudo-doc/config";
export default defineConfig(
zudoDoc({
siteName: "Acme Docs",
headerNav: [
{
label: "Learn",
path: "/docs/learn",
categoryMatch: "learn",
versioned: false,
children: [
{ label: "Guides", path: "/docs/guides", categoryMatch: "guides" },
{ label: "Components", path: "/docs/components", categoryMatch: "components" },
{ label: "Markdown Features", path: "/docs/markdown-features", categoryMatch: "markdown-features" },
],
},
{ label: "Reference", path: "/docs/reference", categoryMatch: "reference" },
],
chromeBindingsModule: "./src/chrome-bindings.tsx",
}),
);versioned: false keeps the Learn link on the current docs, because archived versions have no Learn page. In those versions the section pages use the native fallback.
The landing page asks for the compact view through the native expansion baseline:
---
title: Learn
sidebar_position: 1
sidebar_initial_expansion: collapsed
---
<CategoryNav categories={["guides", "components", "markdown-features"]} />What the Umbrella Does Not Change
Only the paired Header and Sidebar see the umbrella forest. Breadcrumbs, the previous/next pager, search, the sitemap, and the home page grid keep their URL-based contracts. <CategoryNav> on the Learn page lists the same three sections because its categories follow the same order; keep both lists in sync by hand.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| An unlinked heading has its own landing page as the first child | The landing page sits inside a synthetic type: "category" item | Keep the real category node, or use this recipe to make the real page the parent |
| A landing page and its articles appear as unrelated peer links | The articles are siblings of the landing page on disk | Move the files under the landing page's directory, or list them as its editorial members |
The parent row disappeared after adding dirName | autogenerated with dirName inserts only that directory's children | Use items: [] or autogenerated without dirName, and select the row with node mode |
initialPath selects the wrong row | It indexes the resolved visible tree, not URL segments | Write the visible tree down with its indexes and count from it |
| Desktop sidebar and mobile drawer disagree | Only one of Header and Sidebar was replaced, or they got different contexts | Create both from the same context, as createEditorialChrome does |
| A cross-link opens with another section's sidebar | Destination ownership follows the page URL | Expected with this policy; change ownership only as a deliberate host decision |
See Also
How to Structure Navigations — choosing a pattern
Sidebar — sidebar items,
initialPath, andscopeRootHeader Navigation —
categoryMatchand section ownershipHost Chrome Bindings — the
HeaderandSidebarslots