aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pages
diff options
context:
space:
mode:
authorYasutake Yohei <yohei@yasutakeyohei.com>2026-07-01 20:47:25 +0900
committerYasutake Yohei <yohei@yasutakeyohei.com>2026-07-01 20:47:25 +0900
commit4bc0517de93529fa1d17e1720e235e6351146f11 (patch)
tree71c9e8865728b70d9eedd5e61971207f2be5d5ae /src/pages
parent940a50a5d0abcee9c8c70a4afb170377eb32bf61 (diff)
OG画像: index.mdx のタイトルも読み取れるよう修正
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/og/[slug].png.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pages/og/[slug].png.ts b/src/pages/og/[slug].png.ts
index 8aa355b..a18d00c 100644
--- a/src/pages/og/[slug].png.ts
+++ b/src/pages/og/[slug].png.ts
@@ -119,8 +119,11 @@ export async function GET({ params }: { params: { slug: string } }) {
const fileSlug = slug.replace(/--/g, "/");
title = pages[fileSlug];
if (!title) {
- const mdxPath = path.join(contentDir, fileSlug + ".mdx");
- title = readTitle(mdxPath) ?? "小平市議 安竹洋平 公式サイト";
+ // 通常のファイル + index.mdx の両方をチェック
+ title =
+ readTitle(path.join(contentDir, fileSlug + ".mdx")) ??
+ readTitle(path.join(contentDir, fileSlug, "index.mdx")) ??
+ "小平市議 安竹洋平 公式サイト";
}
}