Skip to main content

template.json

Every template directory may include a template.json manifest alongside index.html. It defines the template's display name and its editable fields. When a template is synced from GitHub, the name becomes the template's title and each field becomes an editable input.

A machine-readable JSON Schema is published for editor autocompletion and validation. Reference it from your file with $schema:

{
"$schema": "https://docs.allegrocdp.com/template.schema.json",
"name": "Newsletter Signup",
"fields": [
{
"slug": "headline",
"type": "text",
"label": "Headline",
"default_value": "Stay in the know"
}
]
}

Top-level properties

PropertyTypeRequiredDescription
namestringYesDisplay name (title) of the template. Used as the template title on sync.
fieldsarrayYesThe editable fields exposed by the template. May be empty.

Field properties

PropertyTypeRequiredDescription
slugstringYesPlaceholder identifier. Lowercase letters, numbers, -, and _ only (^[a-z0-9_-]+$).
typestringYesOne of text, number, checkbox.
labelstringNoHuman-readable label shown in the editor. Used as the field's description on sync.
default_valueanyNoInitial value used by the local preview editor.
descriptionstringNoHelp text. Used as the field's description on sync when label is absent.
Field description on sync

When syncing from GitHub, a field's stored description is taken from label first, then description, then an empty string.

In local preview

Local Template Preview reads template.json and renders an editor input per field in its sidebar, seeded with default_value:

TypeInput rendered
textSingle-line text input
numberNumber input
checkboxToggle (value is the string "true" or "false")

The local preview additionally accepts textarea (a multi-line input) for convenience while editing. It is not part of the synced schema above, so use text for fields that sync from GitHub.

Complete example

{
"$schema": "https://docs.allegrocdp.com/template.schema.json",
"name": "Newsletter Signup",
"fields": [
{ "slug": "headline", "type": "text", "label": "Headline", "default_value": "Stay in the know" },
{ "slug": "input_placeholder", "type": "text", "label": "Input placeholder", "default_value": "Enter your email" },
{ "slug": "button_text", "type": "text", "label": "Button text", "default_value": "Subscribe" },
{ "slug": "show_privacy_note", "type": "checkbox", "label": "Show privacy note" }
]
}