Skip to content

feat: generate per-article OG images - #132

Merged
ro80t merged 1 commit into
mainfrom
feat-og-image-generation
Aug 21, 2026
Merged

feat: generate per-article OG images#132
ro80t merged 1 commit into
mainfrom
feat-og-image-generation

Conversation

@ro80t

@ro80t ro80t commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add astro-og-canvas to render a 1200x630 OGP image per article at build time (/og/<article-id>.png), plus a shared fallback image (/og/_site.png) for non-article pages.
  • Wire og:image / twitter:image (and width/height) into Layout.astro, threading an image prop through MainLayout/BlogLayout.
  • Add an optional description field to article frontmatter (falls back to the site description) so authors can customize the OG card text.
  • Japanese text is rendered with the noto-sans-jp "japanese" subset font fetched at build time from Fontsource's CDN (a single full-glyph-coverage file, unlike the per-unicode-range chunks used for the site's own web fonts), so kanji/hiragana/katakana all render correctly without bundling a large font file in the repo.

Test plan

  • npm run build completes and generates /og/<id>.png for every non-draft article plus /og/_site.png
  • Verified rendered PNGs visually (title/description/logo/gradient render correctly, including a long mixed English/Japanese title)
  • Confirmed built HTML includes correct absolute og:image/twitter:image URLs for both an article page and the home page
  • npm run lint shows no new issues (pre-existing CRLF-related prettier warnings on unrelated files are untouched by this change)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Myi55GMKN6FaoJdCGcVvnb

Add astro-og-canvas to render a 1200x630 OG image for every article at
build time (/og/<article-id>.png), plus a site-wide fallback image for
non-article pages. Wires og:image/twitter:image into Layout.astro and
adds an optional description field to article frontmatter.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Myi55GMKN6FaoJdCGcVvnb
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Preview deployed to: https://wktk.moe/pr-preview-132/

github-actions Bot added a commit that referenced this pull request Aug 21, 2026
@ro80t
ro80t merged commit 1bb7145 into main Aug 21, 2026
5 checks passed
@ro80t
ro80t deleted the feat-og-image-generation branch August 21, 2026 09:56
github-actions Bot added a commit that referenced this pull request Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant