docs: generate page-specific social preview images - #1333
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe docs build now generates page-specific 1200×630 social cards with bundled fonts and Resvg. VitePress emits each card in page metadata. Tests and a post-build script validate wrapping, PNG output, metadata, dimensions, and distinct images. ChangesSocial image generation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Documentation pages now publish title-specific social preview cards with matching Open Graph and Twitter metadata. The generated images and metadata are validated during the docs build, with no concrete current-head merge-blocking risk identified. Sequence Diagram(s)sequenceDiagram
participant VitePress
participant socialCard
participant writeSocialCard
participant Resvg
participant Validator
VitePress->>socialCard: Build card from page heading
socialCard->>Resvg: Render SVG as PNG
Resvg-->>socialCard: Return PNG bytes and hashed path
VitePress->>writeSocialCard: Write PNG and metadata URL
Validator->>VitePress: Scan generated pages
Validator->>socialCard: Generate expected card
socialCard-->>Validator: Return expected PNG and path
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR generates page-specific 1200×630 social preview images during the documentation build.
Confidence Score: 5/5The PR appears safe to merge, with the previous image-cache finding fully addressed and no new actionable defects identified. Social image filenames are now derived from the exact PNG bytes that are written, so renderer and rendering-option changes produce fresh URLs. The expanded build checks consistently validate page metadata and emitted image content. Important Files Changed
Reviews (2): Last reviewed commit: "docs: address social preview review feed..." | Re-trigger Greptile |
Shared documentation links now display the page title alongside hk's branding in a generated 1200×630 PNG. Open Graph and Twitter reference the same image with descriptive alt text; content-based URLs refresh when the title or artwork changes.
The build renders locally using resvg and a bundled OFL-licensed Space Grotesk font. The renderer handles long titles and CLI command names without overlapping the logo. Added renderer tests and built-HTML checks to
docs:build.Validation: production docs build passed, all three renderer tests passed, and social metadata and emitted PNG dimensions were verified for 75 pages. Visually reviewed the rendered previews.
AI-assisted — Tool: Codex; model: OpenAI/GPT-6; version: unavailable.
Note
Low Risk
Changes are limited to the docs VitePress build and social metadata; no runtime product or security-sensitive paths.
Overview
Documentation links no longer share a single
og.pngpreview. Each VitePress page now gets a 1200×630 social card built from that page’s heading (homepage uses a fixed tagline), hk branding, and the existing logo.Cards are rendered at build time via
social-images.mjsusing@resvg/resvg-jsand bundled Space Grotesk (no external renderer or system fonts). PNG filenames are keyed by a hash of the image bytes so title, layout, font, or renderer changes get new URLs.transformHeadwrites the PNG intosocial/and sets matching Open Graph and Twitter image tags plus{heading} — hk docsalt text.docs:buildnow runs unit tests for wrapping/truncation and a post-buildcheck-social-images.mjspass that verifies metadata, dimensions, per-page image bytes, and rejects swapped or empty alt text.Reviewed by Cursor Bugbot for commit 2cf143b. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Documentation
Bug Fixes