Serve a PNG Open Graph image so link previews render#106
Merged
Conversation
The site's og:image pointed at og.svg, but no major platform renders an SVG Open Graph image — Reddit, X, Facebook, LinkedIn, Slack, Discord and iMessage all ignore it and fall back to a generic placeholder, which is why the recent Reddit post showed a blank globe instead of a preview. Rasterize og.svg into a 1200x630 og.png and point the meta tags at it, adding og:image:type/width/height/alt and twitter:image:alt. og.svg stays the editable source of truth; a small script renders the PNG with vendored Geist + Fira Code TTFs (loaded explicitly so the output is deterministic and on-brand regardless of the build machine's fonts). Run `pnpm --filter web og` after editing og.svg to regenerate.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Sharing the site on Reddit (and elsewhere) showed no preview — just a generic globe placeholder. The cause:
og:imagepointed atog.svg, and no major platform renders an SVG Open Graph image. Reddit, X/Twitter, Facebook, LinkedIn, Slack, Discord and iMessage all ignore an SVGog:imageand fall back to a placeholder, so shared links looked broken.Fix
og.svginto a 1200×630og.pngand point the meta tags at it.og:image:type,og:image:width,og:image:height,og:image:altandtwitter:image:altfor a more reliable, richer preview.og.svgas the editable source of truth; a small script (sites/web/scripts/generate-og.mjs) renders the PNG with vendored Geist + Fira Code TTFs, loaded explicitly so the output is deterministic and on-brand regardless of the build machine's installed fonts (resvg renders no text at all when it can't resolve a font).Regenerate after editing
og.svg:Verification
astro buildpasses andog.pngis emitted todist.tsc -b).