Schema
The block schema defines the configurable variables and their organisation in the site builder.
The block schema defines the variables a creator can use
to customise the content of a block. It is written as YAML front matter at the top of the block.html file, between ---
delimiters.
A schema consists of two main sections:
| Section | Description | Required |
|---|---|---|
| attributes | Defines the configurable variables with their types, labels, defaults and hints. | Yes |
| layout | Defines how variables are organised into tabs and accordions in the site builder. | No |
Example
The following is an example of a complete block schema:
---
attributes:
heading:
type: string
label: Heading
default: Welcome
text:
type: text
label: Body text
default: <p>Enter some text about your experience.</p>
background_color:
type: color
label: Background colour
default:
palette: body-bg
show_button:
type: boolean
label: Display button
default: true
button_text:
type: string
label: Button text
default: Learn more
layout:
- type: tab
label: Content
elements:
- heading
- text
- type: accordion_toggle
toggle_attribute: show_button
elements:
- button_text
- type: tab
label: Design
elements:
- background_color
---Attributes
The attributes section defines each variable that will be available to the creator in the site builder. Each attribute has
a key (used to access it in Liquid) and a set of properties:
attributes:
heading:
type: string
label: Heading
default: Welcome
hint: The main heading displayed at the top of the blockThe key (heading in this example) is how you reference the variable in your block's Liquid code:
<h1>{{ heading }}</h1>Every attribute requires a type. All other properties are optional. For the full list of available types and their specific
properties, see variable types.
For common properties shared across all variable types (label, default, hint, group, array), see variables.
Layout
The optional layout section defines how variables are presented to the creator in the site builder. Without a layout,
variables are placed into default tabs based on their group property.
When a layout is defined, it replaces the default tabs entirely. Any variable not included in the layout will not be visible to the creator in the site builder.
layout:
- type: tab
label: Content
elements:
- heading
- text
- type: tab
label: Design
elements:
- background_colorLayouts support three types of containers:
| Type | Description |
|---|---|
| Tab | Top-level container that groups variables into tabs. |
| Accordion | Collapsible group nested within a tab. |
| Accordion toggle | Collapsible group controlled by a boolean variable — its elements are shown or hidden based on the boolean value. |
For full layout documentation, see layout.
Template schemas
Schemas can also be used in templates. Product and package booking templates support schemas defined in the same format, allowing creators to customise template-level settings through the site builder.