Skip to content

feat: add Open Graph and Twitter Card metadata - #184

Merged
magnus-madsen merged 2 commits into
masterfrom
feat/og-social-cards
Aug 3, 2026
Merged

feat: add Open Graph and Twitter Card metadata#184
magnus-madsen merged 2 commits into
masterfrom
feat/og-social-cards

Conversation

@magnus-madsen

@magnus-madsen magnus-madsen commented Aug 3, 2026

Copy link
Copy Markdown
Member

Links to flix.dev carried 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 — Zulip, HN, Reddit, X, conference chats — that was the least-styled surface we had.

Tags

Layout.astro now emits a full og:* set driven by the title/description props it already receives, plus twitter:card and twitter:site (@flixlang). Twitter falls back to og:* for title, description, and image, so duplicating those as twitter:* tags would be dead weight.

Verified in the build output across pages:

  • absolute URLs (https://flix.dev/og.png) — scrapers ignore relative ones
  • correct per-page og:url and og:title
  • /blog/ keeps its noindex and still has no canonical, but does get OG tags — a page can be unindexed and still shared

The card

Flix Open Graph card

Built from the site's own vocabulary: favicon red #cf4647 for 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-oriented in the site accent green #28a745, 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 highlighter rather than eyeballing it. The effect is tinted burnt orange #CC5500 to 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 #f7f7f7 panel is 4.03:1. The code is 42px, so the 3:1 large-text threshold applies and it clears it.

Source

design/og.svg is the source for public/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 (@fontsource ships .woff, which fontconfig cannot read directly), and the one real gotcha: the code line uses explicit per-token x offsets, 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 outside public/, so it is not published — confirmed absent from dist/.

Note for review

Console does not appear anywhere in indexExamples.js — the site's examples use IO, Clock, Http, and Logger, and print with a bare println. So the card advertises an effect the homepage never shows. If Console is 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 hints
  • astro build — 10 pages built, og.png shipped to dist/
  • Meta tags inspected in the emitted HTML for /, /faq/, and /blog/

🤖 Generated with Claude Code

magnus-madsen and others added 2 commits August 3, 2026 15:37
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>
@magnus-madsen
magnus-madsen merged commit 7fce4b6 into master Aug 3, 2026
2 checks passed
@magnus-madsen
magnus-madsen deleted the feat/og-social-cards branch August 3, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant