--- import { type Hierarchy } from "../lib/hierarchy.ts"; interface Props { prefix: string; hierarchy: Hierarchy; } const { prefix, hierarchy } = Astro.props; const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, '/'); --- { Object.entries(hierarchy).map(([leader, node]) => { const notePath = `${prefix}/${leader}`; const isActive = pathname === notePath; const linkClasses = isActive ? "active" : ""; if (node.children) { return (
{ node.id ? {node.title || leader} : {node.title || leader} }
{ }
); } return (
{node.title || leader}
); }) }