feat: generate per-article OG images - #132
Merged
Merged
Conversation
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
Contributor
|
🔍 Preview deployed to: https://wktk.moe/pr-preview-132/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
astro-og-canvasto 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.og:image/twitter:image(and width/height) intoLayout.astro, threading animageprop throughMainLayout/BlogLayout.descriptionfield to article frontmatter (falls back to the site description) so authors can customize the OG card text.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 buildcompletes and generates/og/<id>.pngfor every non-draft article plus/og/_site.pngog:image/twitter:imageURLs for both an article page and the home pagenpm run lintshows 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