diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/og-image.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/plugins/og-image.ts b/src/plugins/og-image.ts index f3534e6..7ee6568 100644 --- a/src/plugins/og-image.ts +++ b/src/plugins/og-image.ts @@ -18,12 +18,9 @@ export default function ogImageIntegration(): AstroIntegration { let html = fs.readFileSync(htmlPath, "utf-8"); let slug = page.pathname.replace(/^\/|\/$/g, "") || "index"; - - // 一般質問のサブページは共通のOG画像を使用 - if (slug.startsWith("ippan-situmon/") && slug !== "ippan-situmon") { - slug = "ippan-situmon"; - } - const ogImageUrl = `https://yasutakeyohei.com/og/${slug}.png?v=2`; + // URL-safe: replace / with - for nested paths + const imageSlug = slug.replace(/\//g, "-"); + const ogImageUrl = `https://yasutakeyohei.com/og/${imageSlug}.png?v=2`; html = html.replace( /<meta property="og:image" content="[^"]*"/g, |
