Menu

Post image 1
Post image 2
1 / 2
0

What I learned generating OG images for articles with Playwright and zero API cost

DEV Community·MORINAGA·18 days ago
#JwGJERA6
Reading 0:00
15s threshold

The conclusion first: for a batch of under a few hundred static articles, generating OG images by screenshotting HTML templates with Playwright costs nothing, gives you full CSS control, and requires zero external API keys. The trade-offs are real — it's slow per image, it's not suitable for on-demand generation, and it has a hidden dependency on network availability during the build step. But for my use case, those trade-offs don't hurt. Here's how the script works, what broke, and what I'd do differently. Why I avoided image generation APIs My three directory sites — aiappdex.com, findindiegame.com, ossfind.com — are fully static Astro 5 SSG builds . Articles publish automatically through a GitHub Actions pipeline. The pipeline already handles Dev.to, Hashnode, and Bluesky distribution , plus YouTube thumbnail generation with ffmpeg . I didn't want to add a billed API dependency to this stack.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More