diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-05 13:30:26 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-05 13:30:26 +0900 |
| commit | bb74335a2fc1b0697c2b7088b010484ade784519 (patch) | |
| tree | 39f8033b3d19af3f1376a222725bae6de816c98e /src/pages/kodaira-data | |
| parent | 248d64c096930fa031ce48ddaa4cdb30681918fa (diff) | |
events: 月別アーカイブページを追加
- /kodaira-data/events/YYYY-MM/ をデータから自動生成(2026年10月〜2027年3月の6か月分)
- 会議とイベントを月ごとに表示し、前月・翌月のリンクを設置
- 行事予定ページ下部に月別アーカイブのリンクを追加
- 日付計算を共通モジュール化し、カレンダーと生成ページで同じ結果になるようにした
Diffstat (limited to 'src/pages/kodaira-data')
| -rw-r--r-- | src/pages/kodaira-data/events/[month].astro | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/pages/kodaira-data/events/[month].astro b/src/pages/kodaira-data/events/[month].astro new file mode 100644 index 0000000..1969cee --- /dev/null +++ b/src/pages/kodaira-data/events/[month].astro @@ -0,0 +1,72 @@ +--- +// 月別アーカイブ(/kodaira-data/events/2026-11/ など)。 +// 行事予定のデータ(src/data/schedule/*.json)から、その月の予定だけを静的に生成する。 +import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro'; +import ScheduleTable from '@/components/ScheduleTable.astro'; +import { monthKeys, monthLabel, rowsInMonth } from '@/lib/schedule-months'; +import { SCHEDULE_BASE_PATH } from '@/data/schedule/config'; + +export function getStaticPaths() { + return monthKeys.map((month, i) => ({ + params: { month }, + props: { + month, + prev: monthKeys[i - 1] ?? null, + next: monthKeys[i + 1] ?? null, + }, + })); +} + +const { month, prev, next } = Astro.props as { + month: string; + prev: string | null; + next: string | null; +}; + +const label = monthLabel(month); +const meetingRows = rowsInMonth(month, 'meeting'); +const eventRows = rowsInMonth(month, 'event'); + +const url = (key: string) => `${SCHEDULE_BASE_PATH}${key}/`; +--- + +<StarlightPage + frontmatter={{ + title: `小平市のイベント・行事予定(${label})`, + description: `${label}の小平市のイベントと、審議会・市議会の開催予定の一覧です。日程・会場・申込期限を確認できます。`, + }} +> + <p><a href={SCHEDULE_BASE_PATH}>← 小平市のイベント・行事予定カレンダー(今後)に戻る</a></p> + + <p> + {label}の小平市のイベントと、審議会等・市議会の開催予定です。開催日が過ぎたものも記録として掲載しています。 + 変更になることがありますので、各問い合わせ先へご確認ください。 + </p> + + { + meetingRows.length > 0 && ( + <> + <h2>審議会等・市議会の開催予定</h2> + <div class="schedule-table schedule-table--date-nowrap"> + <ScheduleTable variant="meeting" rows={meetingRows} /> + </div> + </> + ) + } + + { + eventRows.length > 0 && ( + <> + <h2>イベント</h2> + <div class="schedule-table"> + <ScheduleTable variant="event" rows={eventRows} /> + </div> + </> + ) + } + + <nav class="schedule-month-nav" aria-label="月の移動"> + {prev ? <a href={url(prev)}>← {monthLabel(prev)}</a> : <span />} + {next ? <a href={url(next)}>{monthLabel(next)} →</a> : <span />} + </nav> +</StarlightPage> |
