Dynamic text variables

A variable is a placeholder you type into a text field. Fantasma leaves it alone while you edit and turns it into a Ghost helper when the theme is built, so the live site shows the real value.

The default footer already uses two of them. Its copyright line reads © {currentYear} {siteTitle}, which is why a new project shows those words instead of a year and a name until you preview or publish.

Insert one

Text, paragraph, and rich text fields carry a small braces button next to their label. Click it to see the variables that field can use, and pick one to insert it at the cursor. You can also type a variable by hand; the braces are part of it.

What you can use

VariableWhat it becomes
{currentYear}The year the page is rendered
{currentDate}The date the page is rendered
{siteTitle}Your Ghost site title
{siteDescription}Your Ghost site description
{siteUrl}Your Ghost site URL
{currentPageUrl}The URL of the page being viewed
{statusCode}The HTTP status of an error page
{message}The error message on an error page

Where each one works

The first five work anywhere, including on a layout.

{currentPageUrl} needs a page to point at, so it works on home, index, post, page, tag, and author templates. {statusCode} and {message} only work on error templates. A layout is shared by many templates, so only the first five are offered there.

The picker only lists the variables the field you are editing can use, so an unavailable one never reaches the theme.

Values come from Ghost

Fantasma writes the helper; Ghost supplies the value at render time. {siteTitle} shows whatever Settings → General says in Ghost Admin, not anything you type in Fantasma. Change it in Ghost and every page using the variable follows without a new build.