diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-01 21:53:47 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-01 21:53:47 +0900 |
| commit | 9a48acc5eeab8f79062dc34a02b5ec292ebdf555 (patch) | |
| tree | 03a8b28c75e335f5bde7aa0ef62ce4e829e96306 | |
| parent | 6de625ae9fdc1d19d9aa3908fd5ebdcc4a2aa359 (diff) | |
hp-archive: 行事予定ページのSEOを改善
- タイトルと説明文に「行事予定」「傍聴」を追加
- CollectionPage とイベントの ItemList の構造化データを出力
- 最終更新日をページ冒頭に表示
- 案内ページのリンクカードの文言を具体化
| -rw-r--r-- | src/components/ScheduleInteractive.astro | 54 | ||||
| -rw-r--r-- | src/components/ScheduleSeo.astro | 32 | ||||
| -rw-r--r-- | src/content/docs/kodaira-data/hp-archive.mdx | 4 | ||||
| -rw-r--r-- | src/content/docs/kodaira-data/hp-archive/schedule.mdx | 9 | ||||
| -rw-r--r-- | src/data/updates.json | 4 | ||||
| -rw-r--r-- | src/styles/custom.css | 5 |
6 files changed, 101 insertions, 7 deletions
diff --git a/src/components/ScheduleInteractive.astro b/src/components/ScheduleInteractive.astro index cb33ce9..129b38a 100644 --- a/src/components/ScheduleInteractive.astro +++ b/src/components/ScheduleInteractive.astro @@ -529,6 +529,59 @@ }); } + // 検索エンジン向けに、これからのイベントを構造化データ(JSON-LD)で出力する。 + function emitEventStructuredData() { + const upcoming = entries + .filter((e) => e.type === 'event' && e.dates.some((d) => d >= todayKey)) + .map((e) => { + const future = e.dates.filter((d) => d >= todayKey).sort(); + const name = e.name.startsWith(e.category) + ? e.name.slice(e.category.length).trim() + : e.name; + const parts = e.time.split('/'); + const venue = (parts[1] ?? '').trim(); + return { + '@type': 'Event', + name, + startDate: future[0], + eventStatus: 'https://schema.org/EventScheduled', + eventAttendanceMode: 'https://schema.org/OfflineEventAttendanceMode', + location: { + '@type': 'Place', + name: venue || '小平市', + address: { + '@type': 'PostalAddress', + addressLocality: '東京都小平市', + addressCountry: 'JP', + }, + }, + description: e.time, + url: `https://yasutakeyohei.com/kodaira-data/hp-archive/schedule/#${e.rowId}`, + }; + }) + .sort((a, b) => a.startDate.localeCompare(b.startDate)) + .slice(0, 40); + + const existing = document.getElementById('schedule-event-ldjson'); + if (existing) existing.remove(); + if (upcoming.length === 0) return; + + const script = document.createElement('script'); + script.type = 'application/ld+json'; + script.id = 'schedule-event-ldjson'; + script.textContent = JSON.stringify({ + '@context': 'https://schema.org', + '@type': 'ItemList', + name: '小平市のこれからのイベント', + itemListElement: upcoming.map((item, index) => ({ + '@type': 'ListItem', + position: index + 1, + item, + })), + }); + document.head.appendChild(script); + } + // 件数はフィルターのボタンには出さず、ページ下部にまとめて表示する。 function renderCategorySummary() { const summaryEl = document.getElementById('schedule-category-summary'); @@ -543,6 +596,7 @@ buildFilters(); renderCategorySummary(); + emitEventStructuredData(); applyFilter(); renderCalendar(); if (selectedDate) showDayDetails(selectedDate); diff --git a/src/components/ScheduleSeo.astro b/src/components/ScheduleSeo.astro new file mode 100644 index 0000000..0eadb46 --- /dev/null +++ b/src/components/ScheduleSeo.astro @@ -0,0 +1,32 @@ +--- +// このページの構造化データ(JSON-LD)。ビルド日を更新日として出力する。 +const url = 'https://yasutakeyohei.com/kodaira-data/hp-archive/schedule/'; +const updated = new Date(); +const iso = updated.toISOString().slice(0, 10); +const label = `${updated.getFullYear()}年${updated.getMonth() + 1}月${updated.getDate()}日`; + +const data = { + '@context': 'https://schema.org', + '@type': 'CollectionPage', + name: '小平市のイベント・行事予定と審議会の傍聴(2026年10月〜)', + description: + '小平市のイベント・行事予定と、審議会・市議会の傍聴予定を、日程・会場・申込期限つきでまとめた一覧です。カテゴリ別の絞り込みと地図で確認できます。', + url, + inLanguage: 'ja', + dateModified: iso, + about: [ + { '@type': 'Thing', name: '小平市のイベント' }, + { '@type': 'Thing', name: '小平市議会の傍聴' }, + { '@type': 'Thing', name: '小平市の審議会' }, + ], + isPartOf: { + '@type': 'WebSite', + name: '小平市議 安竹洋平 公式サイト', + url: 'https://yasutakeyohei.com/', + }, +}; +--- + +<script type="application/ld+json" set:html={JSON.stringify(data)} /> + +<p class="schedule-updated">最終更新:{label}</p> diff --git a/src/content/docs/kodaira-data/hp-archive.mdx b/src/content/docs/kodaira-data/hp-archive.mdx index 7f65a87..cb5fec7 100644 --- a/src/content/docs/kodaira-data/hp-archive.mdx +++ b/src/content/docs/kodaira-data/hp-archive.mdx @@ -111,9 +111,9 @@ import { LinkCard } from '@astrojs/starlight/components'; ## 今後の予定(審議会等・イベント) <LinkCard - title="小平市のイベント・審議会 日程一覧" + title="小平市のイベント・行事予定と審議会の傍聴" href="/kodaira-data/hp-archive/schedule/" - description="審議会の傍聴予定、イベント、申込期限をカレンダーと一覧で確認できます。" + description="審議会・市議会の傍聴予定、イベント、申込期限を、カレンダー・地図と一覧で確認できます。" /> 審議会等の開催予定と、これから開催されるイベントは、上のリンク先にまとめています。市報こだいら10月1日号・10月19日号・10月20日号、市公式Xのポスト、LoGoフォームのイベント情報から作成しています。 diff --git a/src/content/docs/kodaira-data/hp-archive/schedule.mdx b/src/content/docs/kodaira-data/hp-archive/schedule.mdx index b5ac524..3cc85ee 100644 --- a/src/content/docs/kodaira-data/hp-archive/schedule.mdx +++ b/src/content/docs/kodaira-data/hp-archive/schedule.mdx @@ -1,14 +1,17 @@ --- -title: 小平市のイベント・審議会 日程一覧(2026年10月〜) -description: 小平市ホームページ停止中の2026年10月〜。市報こだいら・市公式X・LoGoフォーム・市議会行事予定表から、審議会や市議会の傍聴予定、イベント、申込期限をまとめました。カテゴリ別に絞り込めます。随時更新しています。 +title: 小平市のイベント・行事予定と審議会の傍聴(2026年10月〜) +description: 小平市のイベント・行事予定と、審議会・市議会の傍聴予定をまとめました。市報こだいら・市公式X・LoGoフォーム・市議会行事予定表から、日程・会場・申込期限を一覧にし、カテゴリ別の絞り込みと地図で確認できます。随時更新しています。 tableOfContents: true --- import ScheduleInteractive from '../../../../components/ScheduleInteractive.astro'; import ScheduleMap from '../../../../components/ScheduleMap.astro'; +import ScheduleSeo from '../../../../components/ScheduleSeo.astro'; [← 案内ページ(小平市ホームページのアーカイブ(暫定)等)に戻る](/kodaira-data/hp-archive/) +<ScheduleSeo /> + 小平市ホームページがご覧いただけないため、市報こだいら(10月1日号・10月19日号・10月20日号)、市公式Xのポスト、LoGoフォームのイベント情報、市議会の行事予定表を確認しました。これらをもとに、今後の審議会等の開催予定とイベントをまとめています。市ホームページが停止しているため、すべてを把握できているとは限りません。延期・中止・会場変更となることもあります。最新の状況は、各担当課にお電話でご確認ください。 @@ -42,7 +45,7 @@ import ScheduleMap from '../../../../components/ScheduleMap.astro'; 位置は、住所をもとにしたおおよその位置です。場所を1点に絞れない予定は地図に表示していません(一覧表には掲載しています)。 -以下の「審議会等の開催予定」と「今後のイベント」は、すべて上のカレンダー・一覧表・地図に反映されています。 +次の「審議会等の開催予定」と「今後のイベント」は、すべて上のカレンダー・一覧表・地図に反映されています。 ## 審議会等の開催予定 diff --git a/src/data/updates.json b/src/data/updates.json index da90aec..f558426 100644 --- a/src/data/updates.json +++ b/src/data/updates.json @@ -7,7 +7,7 @@ "kind": "update" }, { - "title": "小平市のイベント・審議会 日程一覧(2026年10月〜)", + "title": "小平市のイベント・行事予定と審議会の傍聴(2026年10月〜)", "url": "/kodaira-data/hp-archive/schedule/", "group": "", "date": "2026-11-01", @@ -56,7 +56,7 @@ "kind": "new" }, { - "title": "小平市のイベント・審議会 日程一覧(2026年10月〜)", + "title": "小平市のイベント・行事予定と審議会の傍聴(2026年10月〜)", "url": "/kodaira-data/hp-archive/schedule/", "group": "", "date": "2026-10-19", diff --git a/src/styles/custom.css b/src/styles/custom.css index 239156e..6a7e2bc 100644 --- a/src/styles/custom.css +++ b/src/styles/custom.css @@ -2225,6 +2225,11 @@ td.sanpi-open .sanpi-title { font-size: 0.88rem; line-height: 1.7; } +.schedule-updated { + margin: 0.2rem 0 1rem; + color: var(--sl-color-gray-3); + font-size: 0.85rem; +} .schedule-table-status { display: flex; align-items: center; |
