Skip to content

feat(blog): generate OG images on postBuild hook#1047

Open
erickzhao wants to merge 3 commits intomainfrom
feat/og-image-plugin
Open

feat(blog): generate OG images on postBuild hook#1047
erickzhao wants to merge 3 commits intomainfrom
feat/og-image-plugin

Conversation

@erickzhao
Copy link
Member

@erickzhao erickzhao commented Mar 17, 2026

This PR adds a new plugin for OpenGraph image generation for rich social media previews. Under the hood, it uses Vercel's satori library to turn the React layout into an SVG, and then sharp to rasterize that output into a PNG.

Note that this plugin only runs on Docusaurus postBuild, so you'll need to yarn build && yarn serve to see the magic happen.

Testing

The Cloudflare Pages deployment for this PR contains a full build of the website:
https://feat-og-image-plugin.electron-website.pages.dev/

To spot check the image generation, append /og-image.png to the end of any blog post URL (e.g. https://feat-og-image-plugin.electron-website.pages.dev/blog/from-native-to-js/og-image.png)

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2026

Deploying electron-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: d23b7f1
Status: ✅  Deploy successful!
Preview URL: https://a4aeb1c8.electron-website.pages.dev
Branch Preview URL: https://feat-og-image-plugin.electron-website.pages.dev

View logs

@erickzhao erickzhao force-pushed the feat/og-image-plugin branch from 2cb0c48 to 4950004 Compare March 17, 2026 23:29
@socket-security
Copy link

socket-security bot commented Mar 17, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedsatori@​0.25.0971001009870
Addedsharp@​0.34.59110010086100
Updatedsemver@​7.7.3 ⏵ 7.7.410010010089100

View full report

@erickzhao erickzhao force-pushed the feat/og-image-plugin branch from 4950004 to bbae12d Compare March 17, 2026 23:33
@erickzhao erickzhao marked this pull request as ready for review March 17, 2026 23:43
@erickzhao erickzhao requested review from a team as code owners March 17, 2026 23:43
package.json Outdated
Comment on lines +51 to +53
"satori": "^0.25.0",
"semver": "^7.5.4",
"sharp": "^0.34.5",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be in devDependencies since they are only used in the postBuild hook?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, good catch: d23b7f1

@erickzhao erickzhao requested a review from dsanders11 March 18, 2026 05:56
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.

2 participants