From 9526b35ed1bc8e48837da16dd88ee78b2be6187e Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Wed, 16 Sep 2026 14:48:14 +0900 Subject: Breadcrumbs: 構造化データを追加し、ディスレクシアのラベルを修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/starlight/Breadcrumbs.astro | 51 ++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 14 deletions(-) (limited to 'src/components/starlight/Breadcrumbs.astro') diff --git a/src/components/starlight/Breadcrumbs.astro b/src/components/starlight/Breadcrumbs.astro index 8f7aba0..bd65fec 100644 --- a/src/components/starlight/Breadcrumbs.astro +++ b/src/components/starlight/Breadcrumbs.astro @@ -22,9 +22,25 @@ if (breadcrumbs.length > 0) { breadcrumbs[breadcrumbs.length - 1].label = route.entry?.data?.title || breadcrumbs[breadcrumbs.length - 1].label; } +// パンくずリストの構造化データ(BreadcrumbList) +const siteUrl = Astro.site ?? new URL(Astro.url.origin); +const breadcrumbList = { + '@context': 'https://schema.org', + '@type': 'BreadcrumbList', + itemListElement: [{ label: 'ホーム', href: '/' }, ...breadcrumbs].map( + (crumb, i) => ({ + '@type': 'ListItem', + position: i + 1, + name: crumb.label, + item: new URL(crumb.href, siteUrl).href, + }), + ), +}; + function labelMap(segment: string): string | null { const map: Record = { 'ippan-situmon': '一般質問', + 'about-dyslexia': 'ディスレクシアについて', 'gian-tou': '議案等', 'hattatu': '発達関連', 'blog': 'ふらっとブログ', @@ -39,20 +55,27 @@ function labelMap(segment: string): string | null { --- {breadcrumbs.length > 0 && ( - + <> +