8000 docs: OG cards show each page's method result or icon, and fit long titles by hipstersmoothie · Pull Request #1563 · jimp-dev/jimp · GitHub
[go: up one dir, main page]

Skip to content

docs: OG cards show each page's method result or icon, and fit long titles - #1563

Merged
hipstersmoothie merged 3 commits into
mainfrom
sesh/og-card-long-titles
Nov 25, 2026
Merged

hipstersmoothie merged 3 commits into
mainfrom
sesh/og-card-long-titles

Conversation

@hipstersmoothie
@hipstersmoothie hipstersmoothie commented Nov 25, 2026 •
Copy link
Copy Markdown
Collaborator

Two changes to the docs' generated Open Graph cards (#1562).

1. Each card shows its page's subject, not always Jimpy

Every card used to have the same big Jimpy, so they all looked alike. Now each card shows something about its page:

  • 64 cards show the method's result. Method pages, and the Colors and pixels, Compositing and Drawing concepts, show the method applied to the playground's dice photo, in a framed photo. The image comes from the same playground op, with the same thumbnail options, as the method's sticker on /methods/, run at build time with a context that reads public/ from disk (src/og/preview.ts).
  • 53 cards show the page's sticker icon. That covers guides, the other concepts, methods with nothing to picture (read, hash, intToRGBA, …), the type reference, the method index and the playground. The icon is drawn large on a tile in the page's color, like the cards on the home page. A method's icon is chosen the way /methods/ chooses it: its own, then its op's, then its category's.
  • Jimpy stays on every card as a small sticker peeking from the corner of the photo or tile.

src/og/icon.ts draws the icons straight from the markup in src/components/icons.ts with plugin-draw. It handles the small SVG subset those icons use: path, rect, circle, g, fill, stroke, width, caps, joins, opacity and dashes. It isn't an SVG renderer and adds no dependencies.

Icon fix (site and cards): four icons had line paths without fill="none", so SVG's default black fill filled the shapes they enclose: the WASM icon's "W", the EXIF camera's top, the Reading Large Images arrowheads (solid, now open) and the browser's < > chevrons. They now have fill="none", the convention the rest of icons.ts uses. I checked this by measuring the enclosed area of every unfilled stroked path in icons.ts; none are left.

print and measureText show their icon rather than a picture, because their op loads fonts over HTTP, which doesn't work at build time. roundCorners turns its thumbnail off on purpose, so it shows its icon too.

The install line now comes from jimp's own dependencies instead of a hand-written list. For example shadow() now says npm install @jimp/plugin-shadow.

2. Long one-word titles no longer push the picture aside

On 4 cards (measure-text-height, encode-frames, write-frames, distance-from-hash) the method name was wider than the text column. A single word can't wrap, so it pushed Ji 8000 mpy's column right and the card's edge clipped him. The title now also shrinks until its longest word, measured with measureText, fits. The text column has minWidth={0} as a backstop.

Checked

  • The docs build passes (0 errors), with 117 cards.
  • Every card is a picture card or an icon card; none fall back to the big Jimpy.
  • The right edge of the photo frame or icon tile is at the same x on every card of each kind: x = 1097 on all 64 picture cards and x = 1078 on all 53 icon cards. So no title can push it.
  • I checked the four long-title cards before the visuals changed: their splash sat exactly where methods/resize.png's does.

🤖 Generated with Claude Code

hipstersmoothie and others added 2 commits November 24, 2026 18:21
A one-word title wider than the text column, like measureTextHeight(),
can't wrap, so it pushed Jimpy's column right and clipped him. The title
size now also needs its longest word (measured with measureText) to fit,
and the text column has minWidth 0 so nothing in it can push Jimpy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Method cards show the method applied to the playground's dice photo, made
at build time by the same playground op as the method's sticker on
/methods/. Guides, concepts and methods with nothing to picture show the
page's own sticker icon from icons.ts, drawn large with plugin-draw on a
tile in the page's color. Jimpy peeks out from the corner of both.
The install line now comes from jimp's dependencies, so pages about
packages outside jimp (like @jimp/plugin-shadow) install those.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hipstersmoothie hipstersmoothie changed the title docs: shrink OG card titles until their longest word fits docs: OG cards show each page's method result or icon, and fit long titles Nov 25, 2026
SVG fills a path black unless it says otherwise, so line paths without
fill="none" filled the shapes they enclose: the WASM icon's W, the EXIF
camera's top, the large-images arrowheads and the browser's chevrons.
The site and the OG cards both draw them as lines now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hipstersmoothie
hipstersmoothie merged commit ccf7aa9 into main Nov 25, 2026
7 checks passed
@hipstersmoothie
hipstersmoothie deleted the sesh/og-card-long-titles A27B branch November 25, 2026 03:02
@hipstersmoothie
Copy link
Copy Markdown
Collaborator Author

🚀 PR was released in v2.2.0 🚀

@hipstersmoothie hipstersmoothie added the released This issue/pull request has been released. label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released This issue/pull request has been released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0