diff options
Diffstat (limited to 'src/plugins/og-image.ts')
| -rw-r--r-- | src/plugins/og-image.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/og-image.ts b/src/plugins/og-image.ts index 0cfcbc2..c0e14ca 100644 --- a/src/plugins/og-image.ts +++ b/src/plugins/og-image.ts @@ -24,12 +24,17 @@ export default function ogImageIntegration(): AstroIntegration { // 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`; + const ogImageUrl = `https://yasutakeyohei.com/og/${slug}.png?v=2`; // Replace existing og:image with page-specific one html = html.replace( /<meta property="og:image" content="[^"]*"/g, - `<meta property="og:image" content="${ogImageUrl}"` + `<meta property="og:image" content="${ogImageUrl}"`, + ); + // Also update twitter:image + html = html.replace( + /<meta name="twitter:image" content="[^"]*"/g, + `<meta name="twitter:image" content="${ogImageUrl}"`, ); fs.writeFileSync(htmlPath, html, "utf-8"); |
