pixi-reels

For authors

Recipe previews

Every card on the recipes index and every topic page can carry preview media: a gif, an animated webp, a static screenshot, or a short clip. Nothing is required. Drop a file in the right place and it shows up. Anything missing renders a generated placeholder built from the title, so the index and the pages always look finished.

Card thumbnails#

Each card on the /mechanics/ grid is one topic page, and it shows a 16:10 thumbnail. The card looks for its media in this order.

  1. A hand-drawn cover for the slug, from components/recipes-index/covers.ts. Every topic page has one at the moment, so the index shows these.
  2. An explicit image path from the topic page’s frontmatter, if that file exists under public/. See Non-conventional paths.
  3. A file at the conventional path.
  4. The generated placeholder.

The conventional path is:

public/recipes/<slug>/card.<ext>

where <slug> is the topic page’s file name under src/content/recipes/, which is also its URL. There is no registry to edit. The card picks the file up on the next build.

Supported extensions, in priority order:

gif  webp  avif  png  jpg  jpeg  mp4  webm

Animated formats win over static ones, so if both card.gif and card.png exist, the gif is used. mp4 and webm render as a muted, looping, autoplaying <video>. The image is object-cover, so any source proportion works, but compose for about 16:10 so nothing important sits where the crop bites.

When nothing is found, the card shows a placeholder: a tinted faux-reel board with a monogram from the title. The same title always gives the same tint, so the grid stays varied rather than blank.

Inline body images#

Inside a topic page’s MDX body, use the Image component for figures (it is RecipeImage.astro under the hood): gifs of a mechanic mid-motion, before and after stills, a frame breakdown. The same component is available on the Learn and Reference pages.


<Image
  src="/recipes/hold-and-win-spine/jackpot-reveal.gif"
  alt="A MINI coin lands wearing its tier word, spins, and settles on the gold face"
  caption="The tier reveal, frame by frame"
/>
PropRequiredNotes
srcnoPublic URL, e.g. /recipes/<slug>/foo.gif. Omit to force a placeholder.
altyesThe accessible name, and the placeholder’s caption when src is missing.
captionnoFigure caption under the media.
rationoPlaceholder box ratio, default 16/10. Real media uses its own size.

Add as many as you like. They follow the same rule as cards: if the file exists under public/, it renders. If not, you get a placeholder that shows the alt text and the exact path to provide, so an unfinished page reads as “art pending here: public/recipes/x/foo.gif” and never as a broken image. Write the alt as if the image were already there, since it does both jobs.

Non-conventional paths#

If a card asset lives somewhere other than public/recipes/<slug>/card.*, set image in the topic page’s frontmatter (src/content/recipes/<slug>.mdx):

image: /shared/my-shared-preview.gif

An image that points at a real file wins over the conventional lookup. One that points at nothing falls through to the convention, then to the placeholder. A hand-drawn cover still wins over both.

Tips#

  • Keep gifs small. A card is shown at about 370px wide, so an 800px source is plenty. Trim to 2 to 4 seconds and a tight loop. Prefer animated webp over gif for the same motion at a fraction of the bytes.
  • Capture from the live demo. Every recipe ships a runnable demo, so record the canvas region for a 1:1 preview of what the reader will run.
  • Compose for the crop. Cards are object-cover at 16:10. Center the board and leave a little room around it.
  • Use a light background. The site card is light, so export with an opaque light backdrop (or composite onto one) so transparent canvases do not read as gray.

The Hold & Win page has captured card.png files under public/recipes/ from before the covers existed. The index shows its hand-drawn cover instead. Browse the rest of the grid to see the covers and the placeholder they would fall back to.