Repository navigation
link preview card for every profile - #154
Merged
Merged
Conversation
Pasting vibetime.club/@handle into X, Slack or Discord showed the generic site image. Profiles now point og:image at /@handle/og.png: avatar, handle, this week's rank, all-time ships, the 12-week grid, and the top crew's rank, drawn as SVG and rasterised in the Worker with @resvg/resvg-wasm (no native code, ~1.2MB gzipped). The card uses Geist Mono TTFs, since resvg can't read the site's woff2. Cards are cached at the edge per handle per day, keyed on the handle and the date rather than the request's query string, so preview bots rarely reach D1 and made-up URLs can't force renders. Any failure, and any unknown handle, answers with the existing og.png. Emoji are dropped from crew names because the font has no emoji glyphs.
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.
Pasting a profile link into X, Slack or Discord showed the generic site image. Every profile now gets its own card, so when someone shares their profile it shows their week.
What the card shows: avatar, handle, this week's rank, all-time ships with days and this month, the 12-week grid, the top crew's rank this week, and the profile URL. 1200x630, dark theme, Geist Mono.
How it works
GET /@handle/og.pngdraws the card as SVG and rasterises it in the Worker with@resvg/resvg-wasm2.6.2 (MPL-2.0, wasm, no native code). Bundle goes to 2.9MB, 1.18MB gzipped, inside the 10MB paid limit.server/assetsgains Geist Mono Regular and SemiBold TTFs (OFL, licence already inassets/).og:imageat the card with?d=<today>, so sites that cache previews by URL pick up a fresh one daily. Other pages keep/og.png.Keeping it from hurting the site
?x=a, different casing) are served from cache, so preview bots rarely reach D1.og.pngwith a 200. Failures aren't cached.Checked against a local worker with seeded profiles
og.png. With the renderer forced to throw, the card URL also returnsog.png.npm run typecheck --prefix serverclean,npm test228/228.Not checked yet: the production schema (only after deploy), and how X, Slack and Discord actually display it. After deploying, paste a profile link into each, or use their card validators, and fetch a real
/@handle/og.png.Server-only, so it ships as a plain deploy with no npm release.