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
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name (title) of the template. Used as the template title on sync. |
fields | array | Yes | The editable fields exposed by the template. May be empty. |
Field properties
| Property | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Placeholder identifier. Lowercase letters, numbers, -, and _ only (^[a-z0-9_-]+$). |
type | string | Yes | One of text, number, checkbox. |
label | string | No | Human-readable label shown in the editor. Used as the field's description on sync. |
default_value | any | No | Initial value used by the local preview editor. |
description | string | No | Help 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.
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" }
]
}