` — Pagefind UI mounts into it | Empty when `search: false` in config (Pagefind skipped). Populated otherwise. |
| `{{ themeToggle }}` | Dark/light toggle button | Always rendered. |
| `{{ pageActions }}` | "View / Copy as Markdown" buttons | Empty when `llmsButtons: false`. |
## Per-page text
HTML-escaped — safe to interpolate into attributes.
| Token | Source |
| --- | --- |
| `{{ title }}` | Page title (frontmatter `title` → first H1 → file ID) |
| `{{ description }}` | Effective description (frontmatter `description` → `config.description` → empty). Safe to drop into a `
` in your layout — Markbook detects it and skips its own so the tag isn't duplicated. |
| `{{ siteTitle }}` | `config.title` (empty if unset) |
| `{{ browserTitle }}` | Effective `
` value — `${pageTitle} — ${siteTitle}`, collapsed to just one when the page title already equals the site title |
## Arbitrary frontmatter
| Token | Substitutes |
| --- | --- |
| `{{ frontmatter. }}` | Any frontmatter field via dot-path (HTML-escaped). Missing paths render as empty string. |
```yaml
---
author:
name: Tudor
url: https://example.com
---
```
```html
{{ frontmatter.author.name }} ← "Tudor"
{{ frontmatter.author.url }} ← "https://example.com"
{{ frontmatter.author }} ← JSON-stringified object
{{ frontmatter.missing }} ← ""
```
## Validation rules
All throw at build time:
- **Missing `{{ content }}`** — `HTML layout 'X' is missing a {{ content }} placeholder.`
- **Duplicate `{{ content }}`** — `HTML layout 'X' has N {{ content }} placeholders. Exactly one is allowed.`
- **Unknown placeholder name** — `HTML layout 'X' uses unknown placeholder {{ tilte }}.` (typo guard)
- **Named layout not found** — `HTML layout 'landing' not found in: .` (no silent fallback to built-in shell)
## HTML comments are preserved verbatim
Placeholders inside `` are NOT substituted, and the comments make it to the output unchanged. Useful for documenting the layout's vocabulary inline:
```html
```
## Minimal valid layout
```html
{{ browserTitle }}
{{ head }}
{{ pageActions }}
{{ content }}
{{ bodyEnd }}
```
Drop this in `layouts/default.html`, set `layout: 'default'` in your config, and you have a custom-shell site with search, llms.txt, theme toggle, and all the SEO defaults — all from a single ~15-line file.
## Token classification (for the curious)
Internally, tokens fall into two classes:
- **Raw HTML** (substituted verbatim): `content`, `head`, `bodyEnd`, `pageActions`, `search`, `themeToggle`. These are Markbook-generated trusted markup.
- **Text** (HTML-escaped before substitution): `title`, `description`, `siteTitle`, `browserTitle`, plus every `frontmatter.x`. Frontmatter is escape-by-default to prevent accidental HTML injection.
This means it's safe to write:
```html
```
— even if `author` happens to be ``, the value gets HTML-escaped before substitution.