Menu

Node.js Share Card Cache: 3 Contracts for Replaceable Open Graph Images
📰

Node.js Share Card Cache: 3 Contracts for Replaceable Open Graph Images

DEV Community: node·YukiKobayashi880·about 10 hours ago
#D4rhTKrU
#devtonodejs#devto#dev#cutout#processing
Reading 0:00
15s threshold

A media catalog that removes backgrounds from product photos should cache Open Graph share card images independently of the cutout operation. Producing a better cutout and delivering a preview repeatedly have different lifetimes. Reprocessing the original on every crawler request makes bandwidth depend on preview traffic, even when the title and image have not changed.

Short answer: generate an Open Graph card once per content version, cache it under a key derived from the title and template, and regenerate when those inputs change. For product photos, include the source image revision and background-removal settings in that version too; otherwise a better cutout can remain hidden behind an unchanged title.…

Continue reading — create a free account

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