SelfscribeDownloadOpen the app

Certificates

Design one certificate and get one for every name on your list.

Document · Simple · uses mail merge, print

Edit it in the playgroundRead the file

What it shows

Make one certificate per row of a table with a mail merge.

What you learn

Fields that a row fills in, the rows a merge reads, a framed page of your own rules, text that only the template shows, one PDF with a page per row.

Try this

  • Step through the rows with ‹ › over the page, then press Merge… for one PDF with a page each.
  • Change Dev Patel's hours from 24 to 30, and his certificate says 30 hours.
  • Change gold in the palette to #2b6cb0, and the frame, the rule and the seal turn blue.
examples/certificates.self · 97 lines
~~~ selfscribe
# Lesson: Make one certificate per row of a table with a mail merge.
# You learn: fields that a row fills in, the rows a merge reads, a framed page of your own rules, text that only the template shows, one PDF with a page per row.
# Try this: step through the rows with ‹ › over the page, then press Merge… for one PDF with a page each.
# Try this: change Dev Patel's hours from 24 to 30, and his certificate says 30 hours.
# Try this: change `gold` in the palette to #2b6cb0, and the frame, the rule and the seal turn blue.
# summary: Design one certificate and get one for every name on your list.
# category: forms
# tags: document, simple, school, work
# uses: mail merge, print
use data
set title Certificates
set page A4 landscape margins narrow
set style wide
set font EB Garamond
set heading-font Playfair Display

# ---- Mail merge: a name in double braces is a field, filled in from each row --------------
# `set merge graduates` takes the rows from the data block named graduates. A file works too
# (`set merge graduates.csv`), or a block of another document (`set merge school.self#graduates`).
set merge graduates
# What the fields show outside a merge, as in the gallery: the first row.
set name    Amara Okafor
set course  Sourdough and slow breads
set hours   18
set date    7 November 2026
set teacher Luca Ferrante
inline {{_}}                 -> var

# ---- Colours, each with its shade for dark pages ---------------------------------------
palette
  ink    #2a2118  dark #efe6d8
  gold   #8c6a24  dark #e2c27f
  cream  #fffdf7  dark #1f1b16

# ---- "::: certificate" ... ":::": the framed page, centred -------------------------------
block  ::: certificate ... :::  -> section.certificate { text-align: center; padding: 3em clamp(1.2em, 5vw, 3.2em) 2.6em; margin: 0 auto 2.4em; max-width: 50em; color: var(--ink); background: var(--cream); border: 3px double var(--gold); outline: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); outline-offset: -16px; box-shadow: 0 24px 50px -34px rgb(0 0 0 / 0.5) }  as ct-certificate
# A class styles the heading inside the frame only.
class  certificate h1       { margin: 0.2em 0 0; font-size: clamp(1.7em, 4.5vw, 2.5em); font-weight: 600; letter-spacing: 0.01em; color: var(--ink) }

# ---- Lines inside the frame, each by the word it starts with ------------------------------
line   kicker _             -> p.kicker     { margin: 0; font: 700 0.72em/1 var(--doc-font-ui); letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold) }  as ct-kicker
line   to _                 -> p.to         { margin: 2em 0 0.1em; font-style: italic; font-size: 1.1em; opacity: 0.8 }  as ct-to
line   == _ ==              -> p.name       { margin: 0.05em 0 0.15em; font: italic 500 clamp(2.2em, 6vw, 3.1em)/1.15 var(--doc-font-heading); color: var(--ink) }  as ct-name
# "~ ❦ ~" alone on a line: an ornament between two short gold rules.
line   ~ _ ~                -> p.flourish   { display: flex; align-items: center; justify-content: center; gap: 0.8em; margin: 0.3em 0 0.9em; color: var(--gold); font-size: 1.3em }  as ct-flourish
class  flourish::before     { content: ""; width: 4em; border-top: 1px solid var(--gold) }
class  flourish::after      { content: ""; width: 4em; border-top: 1px solid var(--gold) }
line   for _                -> p.for        { max-width: 30em; margin: 0 auto; font-size: 1.2em; line-height: 1.55 }  as ct-for
# "signs A | seal | B": a signature line each side of a round gold seal.
line   signs _              -> div.signs    split "|" span  { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 1.2em 3em; margin: 2.4em 0 0; font-size: 0.95em }  as ct-signs
class  signs > span         { min-width: 13em; padding-top: 0.4em; border-top: 1px solid color-mix(in srgb, var(--ink) 45%, transparent) }
class  signs > span:nth-child(2)  { display: grid; place-items: center; min-width: 0; width: 6.4em; height: 6.4em; padding: 0; border: 2px solid var(--gold); border-radius: 50%; outline: 1px solid var(--gold); outline-offset: 3px; font: 700 0.62em/1.3 var(--doc-font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold) }
~~~
::: certificate
kicker The Old Mill Cookery School · Ludlow
# Certificate of Completion
to This is to certify that
== {{name}} ==
~ ❦ ~
for has completed **{{course}}**, a course of {{hours}} hours in our kitchens, on {{date}}.
signs {{teacher}}, tutor | Since 1998 | Helen Marsh, head of school
:::

{{#unless email}}
## The list

One row is one certificate. A column's name is the field it fills: the `name` column fills `{{name}}`. The table is the merge's list, so no certificate prints it.
{{/unless}}

```data graduates as table title "Who gets a certificate"
name, course, hours:number, date, teacher, email:url
Amara Okafor, Sourdough and slow breads, 18, 7 November 2026, Luca Ferrante, mailto:amara.okafor@example.com
Björn Lindqvist, Knife skills, 6, 7 November 2026, Priya Raman, mailto:bjorn.l@example.com
Chloé Martin, Patisserie foundations, 30, 14 November 2026, Luca Ferrante, mailto:chloe.martin@example.com
Dev Patel, The Italian kitchen, 24, 14 November 2026, Priya Raman, mailto:dev.patel@example.com
Emma O'Neill, Sourdough and slow breads, 18, 21 November 2026, Luca Ferrante, mailto:emma.oneill@example.com
Kenji Watanabe, Knife skills, 6, 21 November 2026, Priya Raman, mailto:kenji.w@example.com
```

{{#unless email}}
## How it's made

- The frame is a `::: certificate` block, and each line inside it is a rule of your own: `kicker`, `to`, `== … ==` for the name, `for` and `signs`.
- Each `{{name}}`, `{{course}}` or `{{hours}}` is a field. `set merge graduates` fills the fields from one row of the table, and ‹ › over the page steps from row to row.
- Merge… makes one PDF with a page for every row. It leaves the list out, and this part too: it sits between `#unless email` and `/unless` markers in double braces, and every row has an email.
- The `set name …` lines in the rules block are what the fields show outside a merge, as in the gallery.

## Try it yourself

1. Step to Dev Patel's row with ‹ ›, then change his hours from 24 to 30. His certificate says 30 hours.
2. Add a line `Farah Haddad, The Italian kitchen, 24, 28 November 2026, Priya Raman, mailto:farah.h@example.com`. The merge has one more page.
3. Change `kicker The Old Mill Cookery School · Ludlow` to the name of your own school or club. Every certificate follows.
4. Change `gold` in the palette to #2b6cb0. The frame, the rule and the seal turn blue.

Next: *Letter to a list* writes one letter per person. *Client statements* merges totals instead of rows.
{{/unless}}