Placeholders sit in double curly braces and are replaced anew on every page. Spaces inside the
braces are allowed: {{ title }} is the same as {{title}}.
| Placeholder | Value |
|---|---|
{{title}} | the page’s title from the frontmatter |
{{slug}} | the page’s path, such as 3-placement/02-the-order |
{{root}} | relative way to the site root — . on the start page, ../.. two levels down |
{{siteTitle}} | configuration.pageTitle from the Quartz configuration |
{{baseUrl}} | configuration.baseUrl, may be empty |
{{locale}} | the page’s language: frontmatter field lang, else configuration.locale — en-US, say |
{{lang}} | only the front part of it: en |
{{frontmatter.field}} | any frontmatter field of the page |
Values are escaped
An & in a page title becomes &, angle brackets are made harmless. A placeholder therefore
cannot smuggle in markup — not even when somebody writes <script> into a title.
Unknown names stay put
{{doesnotexist}} does not become an empty spot; it stays visible in the text. That is deliberate: a
typo shows itself on first sight instead of quietly leaving a hole.
Anyone who needs curly braces as text switches the replacement off for that box:
options:
placeholders: falseFrontmatter fields
{{frontmatter.<field>}} reads any field of the page. The chapter name in this site’s header is
exactly that:
options:
html: '<span data-section="{{frontmatter.section}}"></span>'| What the field holds | What gets inserted |
|---|---|
| text or a number | the value |
| a list | joined with commas: a, b, c |
| an object | nothing — the placeholder stays |
| the field is missing | nothing — the placeholder stays |
Placeholders work in the title too
title: "About {{siteTitle}}"works. The plugin just does not escape there itself — the heading is a text node, which Preact escapes anyway.