diff options
Diffstat (limited to 'astro.config.mjs')
| -rw-r--r-- | astro.config.mjs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/astro.config.mjs b/astro.config.mjs index 6b6406b..6d155c5 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -8,6 +8,7 @@ import sitemap from "@astrojs/sitemap"; import { unified } from "@astrojs/markdown-remark"; import remarkMermaid from "remark-mermaidjs"; import ogImagePlugin from "./src/plugins/og-image"; +import { SCHEDULE_PAGE_FILES } from "./src/data/schedule/content-files.mjs"; import updatesIntegration from "./src/plugins/updates"; // Apache (production) resolves a directory URL to its index.html, so the site can @@ -73,13 +74,31 @@ const gitDates = buildGitDateMap(); function lastmodFor(url) { const path = url.replace(/^https?:\/\/[^/]+/, "").replace(/^\/+|\/+$/g, ""); const bases = path ? [path, `${path}/index`] : ["index"]; + let pageDate; for (const base of bases) { for (const ext of [".mdx", ".md"]) { const date = gitDates.get(`src/content/docs/${base}${ext}`); - if (date) return new Date(date); + if (date) { + pageDate = new Date(date); + break; + } } + if (pageDate) break; + } + + // 行事予定ページは、ページ本体だけでなく予定データ(JSON)の更新も最終更新に含める。 + // ページ冒頭の「最終更新」と dateModified も同じ値を使っている。 + if (path === "kodaira/events") { + const parts = [ + pageDate, + ...SCHEDULE_PAGE_FILES.map((file) => + gitDates.get(file) ? new Date(gitDates.get(file)) : undefined, + ), + ].filter(Boolean); + if (parts.length) return new Date(Math.max(...parts.map((d) => d.getTime()))); } - return undefined; + + return pageDate; } export default defineConfig({ |
