Something went wrong. Try again.
Fork of backnotprop/plannotator with reduced surface area
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243---import { getCollection } from 'astro:content';
const docs = await getCollection('docs');const currentPath = Astro.url.pathname;
// Group by section, sort by sidebar.orderconst sections = new Map<string, typeof docs>();for (const doc of docs.sort((a, b) => a.data.sidebar.order - b.data.sidebar.order)) { const section = doc.data.section || 'General'; if (!sections.has(section)) sections.set(section, []); sections.get(section)!.push(doc);}---<aside class="w-56 shrink-0 border-r border-border/30 overflow-y-auto py-6 px-4 hidden md:block"> {[...sections.entries()].map(([section, sectionDocs]) => ( <div class="mb-6"> <h3 class="text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2">{section}</h3> <ul class="space-y-1"> {sectionDocs.map((doc) => { const href = `/docs/${doc.id}/`; const isActive = currentPath === href; return ( <li> <a href={href} class:list={[ 'block text-xs py-1 px-2 rounded transition-colors', isActive ? 'text-primary bg-primary/10 font-medium' : 'text-muted-foreground hover:text-foreground hover:bg-muted/50', ]} > {doc.data.sidebar?.label || doc.data.title} </a> </li> ); })} </ul> </div> ))}</aside>