Authoring

Frontmatter

The YAML header of a template — the five core keys, the keys a kit adds, their types and when each one is checked.

Every template starts with a YAML mapping between two --- lines. It names the template and the sender profile it goes out under, and carries the envelope text: the subject, the inbox preview line and, for some profiles, the sender. A kit can add keys of its own, such as a footer note.

templates/courier-job.md
---
template: job.offered
profile: driver
subject: "New job: {{pickup_area}} to {{dropoff_area}} · {{fee}}"
preheader: "Accept by {{accept_by}}. {{distance}}, one produce box."
note: If another courier accepts first, the link will say so.
---

The first five keys belong to the engine and mean the same in every kit. note is a key of the Quiet kit, which shows it in its footer.

Look up a core key

KeyTypeRequiredNotes
templatestringyesMust equal the name passed to Compile.
profilestringyesThe name of a Profile in the renderer's Config. Checked by Render.
subjecttextyesMerge tags allowed. At render, a subject that is empty or contains CR, LF or NUL is an error.
preheadertextrecommendedThe inbox preview line. Leaving it out is the warning frontmatter: no preheader. A tag with no value renders as nothing here rather than failing.
fromtextprofile-dependentRequired, and only allowed, when the profile has no fixed From.

"Text" is a YAML string that may hold merge tags. A key of the wrong YAML type is an error at the key, such as frontmatter: "subject" must be a string. A key that is neither a core key nor one the kit declares is frontmatter: unknown key "colour".

A missing required key is reported at 1:1, because there is no key to point at: frontmatter: missing "profile". Every other frontmatter error points at the key's own line and column. A merge-tag error in a one-line subject, preheader or from points at the tag itself; in a multi-line YAML string it points at the key.

Match the name

template exists so the file and the Go code can't drift apart. Compile the file under another name and the compile fails:

Output
payout.sent:2:1: frontmatter: template "payout" does not match name "payout.sent"

Name a profile

Profiles belong to the Renderer, not to the kit, so Compile only checks that profile is a string. Render looks it up and reports a name it doesn't know at the key, with the template's position:

Output
auth.reset:3:1: unknown profile "nope"

Message.Profile carries the name, so your application can route on it. Profiles are described in Profiles and config.

Set the sender

A profile either has a fixed From or leaves the sender to the template. The template's from must match that choice:

Profilefrom in the templateError when broken
Fixed FromNot allowed.frontmatter: "from" is not allowed: profile "security" has a fixed From
No FromRequired.frontmatter: profile "open" has no From, so "from" is required
FromDomain setMust be on that domain.from "kim@other.example" is not on example.com

A literal from is parsed as an address when the template compiles: frontmatter: "from" is not a valid address: mail: no angle-addr. A from with merge tags is parsed at render. Every rule that needs the profile runs at render, reported at the from or profile key.

Use the kit's keys

A kit declares extra keys under frontmatter: in its kit.yaml. They are typed like component attributes and follow the same rules: required, required_with, default and, for an enum, values. Plain declares none. Quiet declares seven, which its layout reads for the masthead and the footer:

KeyTypeDefault
issuetext—
legalflagfalse
noteinline—
abouttext—
reasoninline—
optoutinline—
navflagtrue

What each one shows is in The Quiet kit. In a template, a kit key is written like any other:

templates/box-on-its-way.md
---
template: order.out_for_delivery
profile: buyer
subject: Your produce box is on its way
preheader: "Arriving at {{destination}} by {{eta}} today."
note: "Questions? [Get help](https://loam.example/help). Payment is held until you confirm delivery."
---

Each type takes a different YAML value:

TypeYAML valueError when wrong
text, urlA string. Merge tags allowed.frontmatter: "about" must be a string
inlineA string of exactly one paragraph of inline Markdown. Merge tags allowed.frontmatter: "note" must be one paragraph
intA YAML integer.frontmatter: "seats" must be an integer
flagtrue or false.frontmatter: "legal" must be a boolean
enumOne of the values, literally.frontmatter: "tier" must be one of free, pro
listA YAML list of strings, or one comma-separated string.frontmatter: "topics" must be a list of strings

A required key that is missing is frontmatter: missing "campaign", at 1:1. A key with required_with is reported at the other key: frontmatter: "banner_alt" is required when "banner" is set. An inline value takes no strikethrough, link titles or images (frontmatter: strikethrough is not allowed).

A key the template leaves out takes its default. With no default it is "" for text, url and enum, an empty list, or no value for inline (D49), so a kit template can test it with if. Kit templates read the keys as .Doc.Front; see Templates and views.

The seats, tier, topics, campaign and banner messages above come from a scratch kit made with lttr kit init and given those keys; the shipped kits have no enum, int or list keys. How to declare keys is in kit.yaml.

Next steps

Copyright © 2026