aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pages/og/[slug].png.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pages/og/[slug].png.ts b/src/pages/og/[slug].png.ts
index a18d00c..33ffc6d 100644
--- a/src/pages/og/[slug].png.ts
+++ b/src/pages/og/[slug].png.ts
@@ -122,8 +122,18 @@ export async function GET({ params }: { params: { slug: string } }) {
// 通常のファイル + index.mdx の両方をチェック
title =
readTitle(path.join(contentDir, fileSlug + ".mdx")) ??
- readTitle(path.join(contentDir, fileSlug, "index.mdx")) ??
- "小平市議 安竹洋平 公式サイト";
+ readTitle(path.join(contentDir, fileSlug, "index.mdx"));
+ // 一般質問の月例会インデックスページなら年度・月を補完
+ if (!title && slug.startsWith("ippan-situmon--")) {
+ const parts = fileSlug.split("/");
+ const reiwa = parts[1]?.replace(
+ /^r(\d+)d$/,
+ (_, n) => `令和${n === "1" ? "元" : n}年`,
+ );
+ const month = parts[2]?.replace(/(\d+)gatu/, "$1月");
+ if (reiwa && month) title = `${reiwa}${month}定例会`;
+ }
+ if (!title) title = "小平市議 安竹洋平 公式サイト";
}
}