--- /** * Override of Starlight's Header. * Renders the default nav, then an ob-db-style breadcrumb subheader that * spans the full width below the nav, above all three content columns. * It is `position: fixed` (see .chk-subheader) so it escapes the nav box; * the columns are offset downward by --chk-subheader-h in custom.css. */ import Default from '@astrojs/starlight/components/Header.astro'; import { DOCS_PRODUCTS, getDocsProduct } from '../data/docs-products'; const { sidebar, entry } = Astro.locals.starlightRoute; const title = entry.data.title; const isSplash = entry.data.template === 'splash'; type SidebarItem = | { type: 'link'; label: string; isCurrent: boolean } | { type: 'group'; label: string; entries: SidebarItem[] }; function findGroupTrail(entries: SidebarItem[], trail: string[]): string[] | null { for (const item of entries) { if (item.type === 'group') { const found = findGroupTrail(item.entries, [...trail, item.label]); if (found) return found; } else if (item.isCurrent) { return trail; } } return null; } const groups = isSplash ? [] : findGroupTrail(sidebar as SidebarItem[], []) ?? []; const path = Astro.url.pathname.replace(/\/$/, ''); const isBlog = path === '/blog' || path.startsWith('/blog/'); const product = DOCS_PRODUCTS[getDocsProduct(path)]; const rootLabel = isBlog ? 'Blog' : product.label; const rootHref = isBlog ? '/blog/' : product.href; // Skip the root crumb on a section's own index so it doesn't read "Blog › Blog". const isRootIndex = groups.length === 0 && title === rootLabel; --- { !isSplash && (
) }