--- // Breadcrumbs, the level label and the title. The trail says which tab a // deep page belongs to, and the label says who the page is written for. The // label is left out where the header tab already says it: on a tab's own // page, and where the first crumb names that tab. A page with a `logo` (a // path under the site root) shows it beside its title, on a white square so // a dark mark stays visible in the dark theme. A setup page with no logo file // gets its initials in the same square, as its tile does (sitemarkup.py // platform_tiles). // // Each crumb's label sits in a span: the item keeps its "/" (retrobios.css, // `li { white-space: nowrap }`) and only the label wraps, so a long label // never leaves the separator alone at the start of a line. // // The crumbs and the title stay out of the search index: every excerpt // began with the title and the crumbs matched "bios" on every page. The // title still names the result, as the page's title field. import setups from '../../public/data/picker/index.json'; const PAGE_TITLE_ID = '_top'; const MARK = 40; const LABELS = { start: 'Start here', setup: 'Setup guide', explore: 'Details', reference: 'Reference', contribute: 'For contributors', } as const; // The tab each level is read in, as the header names it. const TABS = { start: 'Start here', setup: 'Setups', explore: 'Explore', reference: 'Reference', contribute: 'Contribute', } as const; // Up to two capitals of a name: MyMinUI is MM (sitemarkup.initials). const initials = (name: string): string => { const capitals = [...name].filter((c) => c !== c.toLowerCase()); return capitals.slice(0, 2).join('') || name.slice(0, 2).toUpperCase(); }; const { id, data } = Astro.locals.starlightRoute.entry; const { title, level, logo } = data; const crumbs = Astro.locals.rbBreadcrumbs ?? []; const badge = level && crumbs.length > 0 && crumbs[0].label !== TABS[level] && crumbs[0].label !== LABELS[level]; const base = import.meta.env.BASE_URL.replace(/\/?$/, '/'); const logoSrc = logo && (/^(https?:)?\//.test(logo) ? logo : base + logo); const setup = !logoSrc && setups.find((entry) => id === `platforms/${entry.platform}`); --- { crumbs.length > 0 && ( ) } {badge && {LABELS[level]}} { logoSrc || setup ? (