Repository navigation
docs: generate each page's Open Graph image with @jimp/layout - #1562
Merged
hipstersmoothie merged 1 commit intoNov 25, 2026
Merged
hipstersmoothie merged 1 commit into
hipstersmoothie merged 1 commit into
Conversation
Every docs page gets its own 1200x630 card, rendered at build time by src/pages/og/ from a JSX layout (src/og/card.tsx): the site's wallpaper drawn from the CSS doodles' SVG paths, a sticker card with the page's section, title, description and install command, and Jimpy on a splash, drawn with plugin-draw from Jimpy.astro's shapes. A Starlight route middleware points og:image and twitter:image at it. The type reference's generated pages share one card, and the home and 404 pages keep the hand-drawn share banner. Fredoka and JetBrains Mono subsets come from scripts/og-fonts.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hipstersmoothie
merged commit Nov 25, 2026
272a8e9
into
sesh/jimp-layout-for-og-images
7 checks passed
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.
Stacked on #1559 (
@jimp/layout); review and merge that first, then retarget this tomain.Every docs page now gets its own Open Graph card, rendered at build time with
@jimp/layout, written in JSX. It's the package's own docs using it.To see the cards, run
pnpm buildinpackages/docsand opendist/og/, e.g.dist/og/methods/draw-rect.pngordist/og/guides/og-images.png.How it works
src/pages/og/[...name].png.tsis a static Astro endpoint. It renders one PNG per docs page at build time.src/og/card.tsxholds the card, written as JSX components with@jimp/layout:npm installpill, which installs the page's package when it isn't part ofjimp, e.g.@jimp/layout.--jp-wallyellow, the dot grid, and the doodles. The doodles are drawn with plugin-draw'sstrokePathfrom the same SVG path data as--jp-wall-doodlesintokens.css.Jimpy.astro, with a white sticker outline, on a generated paint splash centred behind him. (The banner's art has the splash off to one side, which looked unbalanced at this size.) There's no SVG renderer or WASM involved.src/routeData.tsis a Starlight route middleware. It pointsog:imageandtwitter:imageat the page's card and addsog:image:width/height.scripts/og-fonts.shfrom a pinned google/fonts commit. They're TTF becauseloadTTFdoesn't read WOFF2.Choices
og/api.png). Its 117 pages are generated and rarely shared, and individual cards would add about 15 MB to the site.share-banner.png.Checked
pnpm buildinpackages/docspasses:astro checkreports 0 errors.og:imagepoints at a file that exists indist.pnpm install --frozen-lockfilepasses.@jimp/plugin-draw(workspace).Found along the way
Under Astro's
"jsx": "preserve", a file needs/** @jsxRuntime automatic */as well as@jsxImportSource. I've added that to the JSX setup notes in #1559.🤖 Generated with Claude Code