clone

a deno framework for local-first web apps that open instantly, work offline and sync when users choose

feat/141-demo-review-fixes
lofi / website / sidebars.ts
sidebars.ts 1.6K
1import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";2import manifest from "./docs-manifest.json";34// The sidebar is derived from docs-manifest.json so that the site navigation5// and the generated llms.txt / llms-full.txt (tools/site_llms.ts) can never6// disagree about which docs are published or in what order.78type ManifestItem = { id: string; label: string };9type ManifestSection = {10 label: string | null;11 collapsed?: boolean;12 indexId?: string;13 items: ManifestItem[];14 extraLinks?: { label: string; href: string }[];15};1617type SidebarItem =18 | { type: "doc"; id: string; label: string }19 | { type: "link"; label: string; href: string }20 | {21 type: "category";22 label: string;23 collapsed: boolean;24 link?: { type: "doc"; id: string };25 items: SidebarItem[];26 };2728const docsSidebar: SidebarItem[] = (manifest.sections as ManifestSection[]).flatMap(29 (section) => {30 const items: SidebarItem[] = [31 ...section.items.map((item) => ({32 type: "doc" as const,33 id: item.id,34 label: item.label,35 })),36 ...(section.extraLinks ?? []).map((link) => ({37 type: "link" as const,38 label: link.label,39 href: link.href,40 })),41 ];42 if (section.label === null) return items;43 return [{44 type: "category" as const,45 label: section.label,46 collapsed: section.collapsed ?? true,47 ...(section.indexId ? { link: { type: "doc" as const, id: section.indexId } } : {}),48 items,49 }];50 },51);5253const sidebars: SidebarsConfig = { docs: docsSidebar };5455export default sidebars;