# Variants and signature

**Goal:** write one Markdown story and a data table, draw a partner signature on every card or
slide, validate that every placeholder resolves, and export one PDF or image set per row.

When a tour visits ten cities or a campaign ships with several local partners, copying a `.md` file
per venue quickly drifts out of sync. Récit lets you keep a single story source, pull per-row values
from a `variants:` table into `{{…}}` placeholders, and stamp a `brand:` signature on each rendered
card or slide.

The complete working files for this guide live in `examples/webstory-launch/` (`places.csv`,
`places.md`, and `places-deck.md`).

## 1. Create the variants table

Create a `.csv`, `.json`, or `.yaml` file next to your story, one row per variant. An `id` column
names each row: Récit uses it to select a variant during preview and to name the exported files.
Without one, a row is named by its number (`1`, `2`…); two rows with the same `id` are an error.

```csv
id,city,partner,figure
lorem,Lorem,Lorem Studio,42
ipsum,Ipsum,Ipsum Studio,64
dolor,Dolor,Dolor Studio,108
```

## 2. Reference `variants:` and write `{{…}}` placeholders

Point `variants:` in the story's front matter to your data file (resolved relative to the `.md`
file), then reference any column name with `{{column}}` inside headings, body text, directive
attributes, or front matter fields.

Here is `examples/webstory-launch/places.md`:

```markdown
---
title: Lorem Places
description: A three-card web story declined by place and partner
lang: en
format: webstory
aspectRatio: 9:16
variants: places.csv
brand:
  mention: "With the support of {{partner}}"
  position: bottom-right
---

--- id=cover background=backgrounds/hook.svg alt="Violet gradient with two soft circles" overlay=bottom

# Lorem in {{city}}

--- id=numbers background=gradient

## Dolor sit amet

Lorem ipsum dolor sit amet, with {{figure}} sessions hosted in {{city}}.

--- id=cta background=#1d1640

# Meet us in {{city}}

::cta[Learn more]{href=https://recit.dev}
```

To display literal double braces in your text without substituting a variable, escape the opening
braces with a backslash: `\{{city}}` renders as `{{city}}`.

The exact same `variants: places.csv` table and `brand:` block also work in a deck
(`places-deck.md`, without `format:`, so Récit treats it as a [deck](/formats/deck/overview)), as
well as in a JSON twin (`settings.variants` and `settings.brand` of `kind: "story"`).

## 3. Configure the `brand` signature

`brand` draws a compact signature (`logo`, `mention`, or both) on the story's visual surfaces. You
can set it once for an entire project in
[`recit.config.ts`](/documentation/configuration/recit-config#brand) or per story in the front
matter (`settings.brand` in the JSON twin), each layer overriding the previous one key by key, and
use `{{…}}` placeholders from the variant row inside its fields:

```yaml
brand:
  logo: assets/partner-mark.svg
  mention: "With the support of {{partner}}"
  position: bottom-right
  inFilm: false
```

- **Keys:** `logo` (a path relative to the story or project, or an `http(s)` URL to an SVG, PNG,
  JPEG or WebP image), `mention` (short attribution line, which may contain `{{…}}` variables),
  `position` (`top-left`, `top-right`, `bottom-left`, or `bottom-right`, the default), `inFilm`
  (boolean, `false` by default), and `color` (the background colour of the film's signature badge;
  the text is black or white, whichever contrasts more; without it the badge stays dark).
- **Where it draws:** automatically on [web story](/formats/webstory/overview) cards (above `::cta`
  when both sit at the bottom) and on [deck](/formats/deck/overview) slides (on screen, in the
  presenter view, in print/PDF, and when published in a site through `@recit/site-stories`). In a
  [motion](/formats/motion/overview) film, the signature is omitted by default and drawn on every
  shot when `inFilm: true` (`recit build` and image exports copy a local `logo`, while
  `recit render` embeds it as a `data:` URI in the film). A missing local `logo` is an error at its
  line.
- **Empty signature:** when neither `logo` nor `mention` is set (or when both resolve to an empty
  string), Récit renders nothing and reserves no space on the card, slide or shot.

## 4. Preview or build one variant

Pass `--variant <id>` to `recit dev` while authoring, or to `recit build` when publishing a static
bundle for one row of the table:

```bash
recit dev examples/webstory-launch/places.md --variant lorem
recit build examples/webstory-launch/places.md --variant ipsum -o dist/ipsum
```

In `recit dev --variant <id>`, Récit materializes the selected row across the story's language files
and reloads whenever either the story or its `variants:` file changes, cleaning up temporary files
on exit.

## 5. Export every variant at once

Pass `--variants` to [`recit export`](/documentation/reference/cli) with `--to pdf` or `--to images`
to render one output per row in `variants:` (combinable with `--locale` or `--all-locales`):

```bash
# One PDF per row (writes places-deck.lorem.pdf, places-deck.ipsum.pdf, places-deck.dolor.pdf)
recit export examples/webstory-launch/places-deck.md --to pdf --variants -o dist/posters

# Custom filename template using {variant} (the row's id)
recit export examples/webstory-launch/places-deck.md --to pdf --variants -o "dist/poster-{variant}.pdf"

# One set of 9:16 PNG cards per row for the web story
recit export examples/webstory-launch/places.md --to images --variants -o "dist/cards-{variant}"
```

When `-o` points to a directory, Récit names each PDF `<stem>.<variant>.pdf` (or one subfolder per
row for `--to images`) and writes an `exports.json` manifest recording each file's `variant` and its
original `source`. When `-o` contains `{variant}`, Récit substitutes each row's `id` into the path.

## 6. Check the stories

Run `recit validate` on both stories:

```bash
recit validate examples/webstory-launch/places.md examples/webstory-launch/places-deck.md
```

`recit validate` checks the `variants:` file (`variants-source` on an unreadable file or duplicate
`id`), substitutes every row across Markdown, MDX and JSON twins, and refuses any `{{variable}}`
placeholder that has no value in a row — naming the variant and line (`variable-missing`) — or any
`{{variable}}` in a story without `variants:`. When it prints `0` errors and `0` warnings, every
variant and its signature are ready to export.
