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. |
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:
| Type | Input rendered |
|---|---|
text | Single-line text input |
number | Number input |
checkbox | Toggle (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" }
]
}