From 63e2eee92fc06fbad7c8447dd0581fe3c8592b18 Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Mon, 29 Sep 2025 17:30:00 +0100 Subject: [PATCH] remove breadcrumbs --- _components/Breadcrumbs.tsx | 145 ------------------------------------ _includes/doc.tsx | 10 +-- 2 files changed, 1 insertion(+), 154 deletions(-) delete mode 100644 _components/Breadcrumbs.tsx diff --git a/_components/Breadcrumbs.tsx b/_components/Breadcrumbs.tsx deleted file mode 100644 index 2829d3369..000000000 --- a/_components/Breadcrumbs.tsx +++ /dev/null @@ -1,145 +0,0 @@ -import type { Sidebar as Sidebar_, SidebarItem } from "../types.ts"; - -function buildBreadcrumbPath( - url: string, - title: string, - items: SidebarItem[], - breadcrumbPath: SidebarItem[] = [], -): SidebarItem[] | null { - for (const item of items) { - // Check if this is the target page - if (item.href === url) { - return [...breadcrumbPath, { title }]; - } - - // If item has children, search recursively - if (item.items && item.items.length > 0) { - const childPath = buildBreadcrumbPath( - url, - title, - item.items, - [...breadcrumbPath, { title: item.title, href: item.href }], - ); - - if (childPath) { - return childPath; - } - } - } - - return null; -} - -export default function Breadcrumbs(props: { - title: string; - sidebar: Sidebar_; - url: string; -}) { - let breadcrumbs: SidebarItem[] = []; - - // Extract the top-level section from the URL (e.g., "runtime", "deploy") - const topLevelSection = props.url.split("/").filter(Boolean)[0]; - - // Define section name mappings for better display - const sectionNames: Record = { - "runtime": "Runtime", - "services": "Services", - "deploy": "Deploy", - "subhosting": "Subhosting", - "examples": "Examples", - "lint": "Lint", - "api": "API Reference", - }; - - // Search through all sidebar sections to find the breadcrumb path - for (const section of props.sidebar) { - // Check if the current URL is a top-level section - if (section.href === props.url) { - // If this page IS the section, just show the page title - breadcrumbs = [{ title: props.title }]; - break; - } - - // Search within section items if they exist - if (section.items) { - const foundPath = buildBreadcrumbPath( - props.url, - props.title, - section.items, - [], // Start with empty path, we'll add section as base - ); - - if (foundPath) { - // Add the top-level section as the base breadcrumb - const sectionDisplayName = sectionNames[topLevelSection] || - (topLevelSection?.charAt(0).toUpperCase() + - topLevelSection?.slice(1)) || - "Docs"; - - breadcrumbs = [ - { title: sectionDisplayName, href: `/${topLevelSection}/` }, - ...foundPath, - ]; - break; - } - } - } - - // If no breadcrumbs found, just show the current page title - if (breadcrumbs.length === 0) { - breadcrumbs = [{ title: props.title }]; - } - - const linkClasses = - "flex items-center pl-3 py-1.5 underline underline-offset-4 decoration-foreground-tertiary hover:text-foreground-secondary hover:underline-medium hover:bg-foreground-quaternary dark:hover:bg-background-secondary dark:hover:text-foreground-primary rounded transition duration-100 text-xs"; - - const chevronClasses = - "after:w-4 after:h-4 after:[background:url(./img/chevron.svg)_no-repeat_center] after:inline-block after:ml-2"; - - return ( - - ); -} diff --git a/_includes/doc.tsx b/_includes/doc.tsx index cfe3116fa..3e47749be 100644 --- a/_includes/doc.tsx +++ b/_includes/doc.tsx @@ -68,21 +68,13 @@ export default function Doc(data: Lume.Data, helpers: Lume.Helpers) { >
- {hasBreadcrumbs && ( - - )} -
{!(isReference && !isApiLandingPage) && (