aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pages/kodaira
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/kodaira')
-rw-r--r--src/pages/kodaira/events/[period].astro29
-rw-r--r--src/pages/kodaira/events/feed.xml.ts2
2 files changed, 18 insertions, 13 deletions
diff --git a/src/pages/kodaira/events/[period].astro b/src/pages/kodaira/events/[period].astro
index 701d9e3..f2d03df 100644
--- a/src/pages/kodaira/events/[period].astro
+++ b/src/pages/kodaira/events/[period].astro
@@ -1,14 +1,14 @@
---
-// 月別・年度別アーカイブ(/kodaira/events/2026-11/、/kodaira/events/r8/ など)。
-// 行事予定のデータ(src/data/schedule/*.json)から、その期間の予定だけを静的に生成する。
+// 月別・年度別アーカイブ(/kodaira/events/2026-09/、/kodaira/events/r7/ など)。
+// 前々月以前の予定だけを静的ページにする(前月以降はメインページに載せる)。
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
import ScheduleTable from '@/components/ScheduleTable.astro';
import {
- fiscalYearKeys,
+ archiveFiscalYearKeys,
+ archiveMonthKeys,
fiscalYearLabel,
fiscalYearOf,
monthCounts,
- monthKeys,
monthLabel,
monthsInFiscalYear,
rowsInFiscalYear,
@@ -18,22 +18,22 @@ import { SCHEDULE_BASE_PATH } from '@/data/schedule/config';
export function getStaticPaths() {
return [
- ...monthKeys.map((key, i) => ({
+ ...archiveMonthKeys.map((key, i) => ({
params: { period: key },
props: {
kind: 'month' as const,
key,
- prev: monthKeys[i - 1] ?? null,
- next: monthKeys[i + 1] ?? null,
+ prev: archiveMonthKeys[i - 1] ?? null,
+ next: archiveMonthKeys[i + 1] ?? null,
},
})),
- ...fiscalYearKeys.map((key, i) => ({
+ ...archiveFiscalYearKeys.map((key, i) => ({
params: { period: key },
props: {
kind: 'fiscal' as const,
key,
- prev: fiscalYearKeys[i - 1] ?? null,
- next: fiscalYearKeys[i + 1] ?? null,
+ prev: archiveFiscalYearKeys[i - 1] ?? null,
+ next: archiveFiscalYearKeys[i + 1] ?? null,
},
})),
];
@@ -58,6 +58,11 @@ const eventRows =
// 年度ページでは、その年度の月別ページへの一覧も並べる。
const months = kind === 'fiscal' ? monthsInFiscalYear(key) : [];
+// 月別ページから年度ページに戻れるのは、その年度のページが存在するときだけ。
+const fiscalYearForKey = kind === 'month' ? fiscalYearOf(key) : null;
+const hasFiscalPage =
+ fiscalYearForKey !== null && archiveFiscalYearKeys.includes(fiscalYearForKey);
+
const url = (period: string) => `${SCHEDULE_BASE_PATH}${period}/`;
// 期間がすべて過去か、すべて未来か、今日を含むかで説明文を変える。
@@ -133,9 +138,9 @@ const description = isAllPast
}
{
- kind === 'month' && (
+ kind === 'month' && hasFiscalPage && fiscalYearForKey && (
<p class="schedule-fiscal-link">
- <a href={url(fiscalYearOf(key))}>{fiscalYearLabel(fiscalYearOf(key))}の予定をまとめて見る</a>
+ <a href={url(fiscalYearForKey)}>{fiscalYearLabel(fiscalYearForKey)}の予定をまとめて見る</a>
</p>
)
}
diff --git a/src/pages/kodaira/events/feed.xml.ts b/src/pages/kodaira/events/feed.xml.ts
index 860f5f2..a76b775 100644
--- a/src/pages/kodaira/events/feed.xml.ts
+++ b/src/pages/kodaira/events/feed.xml.ts
@@ -46,7 +46,7 @@ const itemXml = ({ item: { type, row }, upcoming }: (typeof entries)[number]) =>
const datesLabel = upcoming
.map((date) => `${Number(date.slice(5, 7))}月${Number(date.slice(8, 10))}日`)
.join('、');
- const link = `${SITE_URL}${SCHEDULE_BASE_PATH}${upcoming[0].slice(0, 7)}/`;
+ const link = `${SITE_URL}${SCHEDULE_BASE_PATH}`;
const guid = `${SITE_URL}${SCHEDULE_BASE_PATH}#${type}-${upcoming[0]}-${encodeURIComponent(title)}`;
return ` <item>