aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/plugins
diff options
context:
space:
mode:
authorYasutake Yohei <yohei@yasutakeyohei.com>2026-07-01 19:24:21 +0900
committerYasutake Yohei <yohei@yasutakeyohei.com>2026-07-01 19:24:21 +0900
commit1a357e558fb7336761cbd2241d285c6077a11216 (patch)
tree19e786c770f06561061e70f2c51acc7409142142 /src/plugins
parent07a9910fbcfc702c6a1ac0f65242a96e145383b9 (diff)
OG画像: 一般質問サブページも個別OG画像を生成するよう対応
スラッシュを - に置き換えて単一セグメントルートで全ページ対応
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/og-image.ts9
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,