From 6ae791ee8ee72bee88ec852e237a70fefbecd2d0 Mon Sep 17 00:00:00 2001 From: Yasutake Yohei Date: Wed, 1 Jul 2026 18:30:50 +0900 Subject: og-image.ts: 一般質問ページの目次サイドバーを非表示に MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/og-image.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/og-image.ts b/src/plugins/og-image.ts index 3ff1f39..d85f87b 100644 --- a/src/plugins/og-image.ts +++ b/src/plugins/og-image.ts @@ -3,10 +3,6 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -/** - * Post-process built HTML files to set per-page og:image. - * Replaces the default og:image with a page-specific one based on URL path. - */ export default function ogImageIntegration(): AstroIntegration { return { name: "og-image-per-page", @@ -21,17 +17,13 @@ export default function ogImageIntegration(): AstroIntegration { let html = fs.readFileSync(htmlPath, "utf-8"); - // Derive slug from pathname: e.g., "/whisper-to-ai-moji-okoshi/" → "whisper-to-ai-moji-okoshi" let slug = page.pathname.replace(/^\/|\/$/g, "") || "index"; - const ogImageUrl = `https://yasutakeyohei.com/og/${slug}.png?v=2`; - // Replace existing og:image with page-specific one html = html.replace( /about-dyslexiaディスレクシアについて<`); + // 一般質問ページ: 目次サイドバーを非表示 + if (page.pathname.includes("ippan-situmon")) { + html = html.replace( + "", + "", + ); + } + fs.writeFileSync(htmlPath, html, "utf-8"); } }, -- cgit v1.3.1