feat(plugin): add plugin-og-image for dynamic OG image generation #2795
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
Implements
@rspress/plugin-og-imageto automatically generate Open Graph images (1200x630 PNG) for each page during build. Uses Satori for SVG rendering from JSX templates and Sharp for PNG conversion.Related Issue
Closes #[issue_number]
Ref: rolldown/rolldown#7135
Implementation
Core Architecture
extendPageDatahook: Collects page metadata (title, description) during buildconfighook: Injectsog:imagemeta tags into SSR HTML viaconfig.headafterBuildhook: Generates PNG images in/og/{route-path}.pngstructureKey Dependencies
[email protected]: React-like JSX → SVG rendering[email protected]: SVG → PNG conversionCustomization
ogBackgroundColor,ogTextColor)Usage
Result
https://v2.rspress.rs/guide/start/getting-startedhttps://v2.rspress.rs/og/guide/start/getting-started.png<meta property="og:image" content="..." />Checklist
Original prompt
plugin-og-image#2794💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.