diff options
| -rw-r--r-- | src/pages/og/[slug].png.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/pages/og/[slug].png.ts b/src/pages/og/[slug].png.ts index 67a4d7c..c84af95 100644 --- a/src/pages/og/[slug].png.ts +++ b/src/pages/og/[slug].png.ts @@ -112,12 +112,16 @@ const stars = [ export async function GET({ params }: { params: { slug: string } }) { const slug = params.slug; - // Convert - back to / for nested paths - const fileSlug = slug.replace(/-/g, "/"); - let title = pages[fileSlug]; + // まずそのままマッチ(kousbunsyo-kanri などの手動ページ) + let title = pages[slug]; if (!title) { - const mdxPath = path.join(contentDir, fileSlug + ".mdx"); - title = readTitle(mdxPath) ?? "小平市議 安竹洋平 公式サイト"; + // - を / に戻して確認(ippan-situmon-r7d-3gatu → ippan-situmon/r7d/3gatu) + const fileSlug = slug.replace(/-/g, "/"); + title = pages[fileSlug]; + if (!title) { + const mdxPath = path.join(contentDir, fileSlug + ".mdx"); + title = readTitle(mdxPath) ?? "小平市議 安竹洋平 公式サイト"; + } } const svg = await satori( |
