Skip to content

docs-site/og-image

Renders a page’s Open Graph card: satori lays it out as SVG, resvg rasterizes it to PNG.

Interface Description
OgCardContent What one Open Graph card shows: a title, and optionally a description, a code signature and a badge.
RenderOgImageOptions The per-site part of every card: the fonts, the logo and the brand text in the footer.
Function Description
computeOgHash Hashes a card’s content, so an unchanged card is not rendered again.
loadFonts Loads the fonts satori needs to render text. This package ships inter-latin-400-normal.ttf / inter-latin-700-normal.ttf under assets/docs-site/fonts; this falls back to any other .ttf/.otf in fontsDirectory and returns null when the directory holds none, so the caller can skip OG generation instead of crashing the build.
loadLogoDataUri Rasterize an SVG favicon to a PNG data URI via resvg for embedding in the satori layout (satori’s <img> needs a raster/data-URI source). Returns null when the file is missing so the caller can render the card without a logo. Call this ONCE and reuse the result across all cards.
renderOgImage Renders a page’s card to a PNG.