feat: add Open Graph and Twitter Card metadata - #184
Merged
Conversation
Links to flix.dev had no og:* or twitter:* tags. Slack and LinkedIn fell back to <title> and <meta name="description"> and produced a text-only card; X showed no card at all, just a plain link. For a project that spreads mostly through link-sharing, that is the least-styled surface we have. Layout.astro now emits a full og:* set driven by the title/description props it already takes, plus twitter:card and twitter:site. Twitter falls back to og:* for title, description, and image, so duplicating those as twitter:* tags would be dead weight. The card itself is 1200x630, built from the site's own vocabulary: the favicon red for the F mark and edge bar, the homepage motto with `effect-oriented` in the site accent green, and a single Flix signature in the exact colors src/components/InlineEditor.astro emits, verified by tokenizing the line with the project's own Shiki setup. The effect is tinted burnt orange to draw the eye to it; the `\` stays black so it reads as syntax. One line of code rather than a snippet is deliberate. Slack renders these cards around 360px wide, so a 1200px image lands at ~30% scale and anything denser turns to mush. design/og.svg is the source for public/og.png, and carries a header comment covering how to rasterize it, the Open Sans/fontconfig wrinkle, and the per-token x offsets the code line depends on. It lives outside public/ so it is not published; verified absent from dist/. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The favicon's F is italic; the card was setting it upright in Open Sans, which made the mark the one element that did not match its own icon. Sized from the favicon rather than by eye: its F is 62.5% of the tile height, and Ubuntu's cap height is 0.693 em, so 94px reproduces that ratio. The previous 68px was noticeably timid by comparison. The glyph is embedded as an outline rather than set as live text. Ubuntu is not a system font and not a project dependency, so a font-family reference would silently substitute on any other machine and quietly break design/og.svg as a reproducible source. Outlining also matches normal practice for a logo mark. Verified: rendering the SVG with Ubuntu absent produces 0 differing pixels against the shipped PNG. No new dependency. @fontsource/ubuntu was installed with --no-save --no-package-lock to extract the outline, then removed; package.json and package-lock.json are untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Links to flix.dev carried no
og:*ortwitter:*tags. Slack and LinkedIn fell back to<title>and<meta name="description">and produced a text-only card; X showed no card at all, just a plain link. For a project that spreads mostly through link-sharing — Zulip, HN, Reddit, X, conference chats — that was the least-styled surface we had.Tags
Layout.astronow emits a fullog:*set driven by thetitle/descriptionprops it already receives, plustwitter:cardandtwitter:site(@flixlang). Twitter falls back toog:*for title, description, and image, so duplicating those astwitter:*tags would be dead weight.Verified in the build output across pages:
https://flix.dev/og.png) — scrapers ignore relative onesog:urlandog:title/blog/keeps itsnoindexand still has no canonical, but does get OG tags — a page can be unindexed and still sharedThe card
Built from the site's own vocabulary: favicon red
#cf4647for the F mark and edge bar, with the F set in Ubuntu Bold Italic to match the favicon's italic letterform — sized so its cap height is 62.5% of the tile, the ratio measured off the icon itself. The glyph is embedded as an outline rather than live text, since Ubuntu is neither a system font nor a project dependency and would otherwise silently substitute elsewhere; rendering the SVG with Ubuntu absent gives 0 differing pixels. No new dependency was added.Also from the site's vocabulary: the homepage motto with
effect-orientedin the site accent green#28a745, and a single Flix signature in the exact colorssrc/components/InlineEditor.astroemits — verified by tokenizing the line with the project's own Shiki highlighter rather than eyeballing it. The effect is tinted burnt orange#CC5500to draw the eye to it; the\stays black so it reads as syntax rather than part of the effect name.One line of code rather than a snippet is deliberate. Slack renders these ~360px wide, X ~500px, Discord ~400px. A 1200px image at 360px is 30% scale, so anything denser turns to mush. Checked the downscaled render — the code line stays legible.
Burnt orange on the
#f7f7f7panel is 4.03:1. The code is 42px, so the 3:1 large-text threshold applies and it clears it.Source
design/og.svgis the source forpublic/og.png— the PNG was rasterized from the committed file, so the repo contains the thing that actually produced the asset rather than a binary blob with no provenance. Its header comment covers how to rasterize it, the Open Sans/fontconfig wrinkle (@fontsourceships.woff, which fontconfig cannot read directly), and the one real gotcha: the code line uses explicit per-tokenxoffsets, because giving the effect its own fill means it cannot be a single<text>. Offsets assume Monaco's 0.6001 em advance at 42px, so editing the code text means recomputing them.design/sits outsidepublic/, so it is not published — confirmed absent fromdist/.Note for review
Consoledoes not appear anywhere inindexExamples.js— the site's examples useIO,Clock,Http, andLogger, and print with a bareprintln. So the card advertises an effect the homepage never shows. IfConsoleis the newer stdlib idiom then the examples are what's out of date, but flagging it since the two disagree.Testing
astro check— 0 errors, 0 warnings, 0 hintsastro build— 10 pages built,og.pngshipped todist//,/faq/, and/blog/🤖 Generated with Claude Code