---
interface BreadcrumbItem {
label: string;
href?: string;
}
interface Props {
items: BreadcrumbItem[];
base: string;
}
import { SITE_ORIGIN } from '../data/site';
const { items, base } = Astro.props;
const allItems = [{ label: 'Home', href: `${base}/` }, ...items];
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: allItems.map((item, i) => ({
'@type': 'ListItem',
position: i + 1,
name: item.label,
...(item.href ? { item: `${SITE_ORIGIN}${item.href}` } : {}),
})),
};
---