Skip to content

feat(www2): restore wide OG cards, add square ones for feeds - #31

Merged
dmythro merged 3 commits into
mainfrom
feat/og-wide-and-square
Jul 29, 2026
Merged

feat(www2): restore wide OG cards, add square ones for feeds#31
dmythro merged 3 commits into
mainfrom
feat/og-wide-and-square

Conversation

@dmythro

@dmythro dmythro commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Why

The cards were rebuilt around a centre square so feed readers could crop them without beheading the title — Reeder keeps the middle 630px and drops the rest, which once turned countries-list into "tries-list" and cut the icon and domain entirely.

That worked, but the wide preview paid for it. Laying everything inside the middle 630px leaves the outer thirds as bare background, so a chat preview reads as an almost empty image with a caption floating in the middle.

What

Restore the edge-to-edge layout for og:image — masthead with icon and domain, large title, description, tags along the foot — and give feeds a second render of the same card on a genuinely square 1200×1200 canvas. Nothing is cropped in either place, and neither consumer pays for the other.

wide 1200×630 square 1200×1200
used by og:image on every page RSS + JSON Feed image
count 26 26
top / bottom margin 74px / 82px 74px / 82px

Corners are anchored identically at both shapes; the square simply has more air between them.

A bug this surfaced

justify-content: space-between distributes children, so a card with no tags had only two of them and the copy fell to the floor. Every standing page — cv, contact, open-source, projects — was rendering that way, on both shapes.

Fixed by anchoring the masthead and tags to the corners and letting the copy claim what is left, centring in it. One rule now covers all four cases:

case before (above / below copy) after
wide, tags 107 / 112 107 / 112
wide, no tags 307 / 78 161 / 224
square, tags 392 / 397
square, no tags 446 / 509

Carried over from the square-safe version

Those changes were not all layout — the useful parts stay:

  • white-space:nowrap + flex-shrink:0 on tags, so hyphenated ones like react-query stay one line at fixed height
  • display:flex;flex-direction:column on title and description — the renderer measures nested columns short without it
  • Sentence-aware clamp and the shared OG_DESCRIPTION_LIMIT, still asserted by og-cards.test.ts
  • flex-wrap on the tag row, which the original layout lacked

Also

  • CV card gains the full stop every other card already ended on. Added in getPageCopy rather than in descriptionShort, since that same string is the navbar tagline and the CV page subtitle — and only when the copy does not already close itself.
  • overflow:hidden on the card. Every one of the 52 clears its edges by 70px today, but a long title over a long description over two rows of tags out-measures the wide frame.

Verified

All 52 generated cards measured programmatically: no ink touches any edge, tightest margin 70px. Lint, types, 37 tests and the build are green. Reviewed locally with CodeRabbit CLI; both findings addressed above.

dmythro added 3 commits July 29, 2026 03:27
The cards were rebuilt around a centre square so feed readers could crop
them without beheading the title. It worked, but it cost the wide preview:
laying everything inside the middle 630px leaves the outer thirds as bare
background, and a chat preview reads as an almost empty image with a
caption floating in it.

Restore the edge-to-edge layout — masthead with icon and domain, large
title, description, tags along the foot — and give feeds a second render
of the same card on a genuinely square canvas instead. Nothing is cropped
in either place, and neither consumer pays for the other.

On the square the copy and tags are grouped rather than spread: there is
570px more height, and spacing three bands across it strands the title
alone in the middle.

Keeps the fixes the square version brought with it — nowrap tags that
stay one line, flex columns so the renderer measures text properly, the
sentence-aware clamp, and the shared description budget.

Feeds now point at the square card, and the CV card gains the full stop
every other card already ended on — added where the copy is used as a
description, since the same string is the navbar tagline.
The cards were rebuilt around a centre square so feed readers could crop
them without beheading the title. It worked, but the wide preview paid
for it: laying everything inside the middle 630px leaves the outer thirds
as bare background, and a chat preview reads as an almost empty image
with a caption floating in it.

Restore the edge-to-edge layout — masthead with icon and domain, large
title, description, tags along the foot — and give feeds a second render
of the same card on a genuinely square canvas instead. Nothing is cropped
in either place, and neither consumer pays for the other.

Anchor the masthead and tags to the corners and let the copy claim what
is left, centring in it. `space-between` alone distributes children, so a
card with no tags had only two of them and the copy fell to the floor —
which is what every standing page was doing, on both shapes.

Keeps what the square version brought with it: nowrap tags that stay one
line, flex columns so the renderer measures text properly, the
sentence-aware clamp and the shared description budget.

Feeds now point at the square card, and the CV card gains the full stop
every other card already ended on — added where the copy is used as a
description, since the same string is the navbar tagline and the CV page
subtitle.
Appending a period unconditionally would double up the moment a
translation ended on punctuation of its own; only add one when the copy
does not already close itself.

Clip the card to its canvas too. Every card clears the edges by 70px
today, but a long title over a long description over two rows of tags
out-measures the wide frame, and clipping beats spilling.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ee325fa-4ade-4b8e-a8fa-97a409446b29

📥 Commits

Reviewing files that changed from the base of the PR and between 4167ce0 and d16d8ee.

📒 Files selected for processing (4)
  • apps/www2/src/pages/og/square/[locale]/[...page].png.ts
  • apps/www2/src/pages/og/square/[locale]/projects/[slug].png.ts
  • apps/www2/src/utils/feed.ts
  • apps/www2/src/utils/ogImage.ts

📝 Walkthrough

Walkthrough

Adds square OG image rendering with dedicated dimensions, layout handling, and route helpers. New localized Astro routes generate square PNGs for pages and projects. Feed entries now reference square image URLs, render square image dimensions, and normalize punctuation in CV descriptions.

Sequence Diagram(s)

sequenceDiagram
  participant Feed as Feed utilities
  participant Route as Square OG route
  participant Card as Localized card data
  participant Renderer as renderOgImage
  Feed->>Route: reference square image URL
  Route->>Card: load page or project card data
  Route->>Renderer: render card with square size
  Renderer-->>Route: return PNG bytes
  Route-->>Feed: serve image/png response
Loading

Possibly related PRs

  • dmythro/dmythro.com#25: Introduces the OG image generator later extended here with square rendering support.

Poem

A rabbit hops where square cards glow,
With tidy paths in rows below.
Page and project, side by side,
Now wear a perfect square with pride.
A final dot makes copy neat—
Carrots cheer the new feed treat! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: restoring wide OG cards and adding square feed cards.
Description check ✅ Passed The description matches the changeset and explains the wide/square OG card update in detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/og-wide-and-square

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dmythro
dmythro merged commit 76db8db into main Jul 29, 2026
4 checks passed
@dmythro
dmythro deleted the feat/og-wide-and-square branch July 29, 2026 00:57
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