A Splitleaf page is plain HTML. A small set of data-* attributes is the template language: components, content lists, bindings and a few build hints. The Design panel writes these attributes for you. You can also write them by hand.
There are three kinds:
| Kind | Example | At publish |
|---|---|---|
| Markers | data-opt-, data-bind-, data-prop-* | The build reads them, then removes them |
| Live hooks | data-link-type, variant attributes, filter forms | Kept, because CSS or a script on the live site uses them |
| App-only | data-opt-ui, data-opt-ui-id | Never in a site file. The App removes them when it saves. |
JSON values sit inside attributes. In a file they are HTML-escaped ("). The examples here use single quotes, which is also valid HTML.
For the component attributes (data-opt-component, data-opt-instance, data-prop-*), see Component files.
Content lists
A list of items needs three levels: a content block, a list and an item.
<div data-opt-dynamic="blog">
<div class="post-list" data-opt-list="latest-posts"
data-opt-query='{"sort":[{"field":"publishedAt","dir":"desc"}],"limit":3}'>
<a class="post-row" data-opt-item data-bind-attr="href:@url">
<time data-bind-text="publishedAt" data-bind-format="date:medium">Date</time>
<span data-bind-text="title">Title</span>
</a>
</div>
</div>
The build repeats the item once for each post. The live HTML has no markers:
<div>
<div class="post-list">
<a href="/blog/welcome-to-northlight" class="post-row">
<time datetime="2026-09-20">Sep 20, 2026</time>
<span>Welcome to Northlight</span>
</a>
</div>
</div>
| Attribute | Goes on | Value |
|---|---|---|
data-opt-dynamic | A wrapper around the list | The collection folder name, for example blog |
data-opt-list | The list | An ID, unique on the page |
data-opt-query | The list | JSON: filter, sort, limit and start. No value means every item. |
data-opt-item | A direct child of the list | No value. The build repeats it for each item. |
A list takes its collection from the nearest data-opt-dynamic above it. A list inside an item of another list repeats for each outer item, three levels deep at most.
The query
{ "filter": { "op": "and" | "or", "rules": [ { "field", "cmp", "value" }, … ] },
"sort": [ { "field": "publishedAt", "dir": "asc" | "desc" | "random" } ],
"limit": 3,
"start": 0 }
The build filters, then sorts, then skips start, then takes limit.
| Comparators | For |
|---|---|
eq, neq, contains, not-contains, starts-with, ends-with | Text. Case does not matter. |
gt, gte, lt, lte | Numbers |
before, after | Dates |
is-true, is-false | Switches |
is-set, is-not-set | A value, or no value |
in, includes | A value in a list, or a list that holds the value |
ref-eq, ref-current, ref-not-current | Reference fields |
Bindings
| Attribute | Value | What it does |
|---|---|---|
data-bind-text | Field | Sets the text of the element |
data-bind-html | A Markdown or rich text field | Sets the inside of the element as HTML |
data-bind-attr | attr:field pairs, joined by ; | Sets attributes, for example href:@url; src:coverImage |
data-bind-attr-template | JSON, for example {"aria-label":"Read ${title}"} | Sets an attribute from text mixed with fields |
data-bind-format | date:short, date:medium, date:long, date:full, datetime:…, time:…, number:0 to number:3 | Formats a date or a number in the language of the page |
data-bind-rollup | <list id>:count, or <list id>:sum:<field> (also avg, min, max) | Sets the text to a count or a sum over a list |
| Field path | Gives |
|---|---|
title, excerpt, … | A field from _collection.json |
@url | The URL of the item page |
@slug | The slug of the item |
@id | The item ID |
author.title | A field of the item that a reference field points to |
Bindings work in a list item and on a content template. Outside of these, the build removes the marker and the placeholder text ships.
Display rules
data-opt-display shows or hides an element by a rule. Use it for an empty state, or to hide an image when an item has none.
<picture data-opt-display='{"groups":[{"match":"all","visibility":"visible",
"conditions":[{"source":"field","field":"coverImage","op":"is-set"}]}],"else":"hidden"}' hidden>
<img alt="" data-bind-attr="src:coverImage">
</picture>
| Condition source | Example |
|---|---|
field | { "source": "field", "field": "coverImage", "op": "is-set" } |
list | { "source": "list", "list": "latest-posts", "op": "is-empty" } |
filter | { "source": "filter", "op": "no-results" }. The browser decides this one. |
At publish the build removes a rule it can decide. It removes a hidden element with it.
Filters
A form that filters a list in the browser.
<form data-opt-filter="latest-posts">
<input type="search" data-opt-filter-field="title" data-opt-filter-cmp="contains">
</form>
| Attribute | Goes on | Value |
|---|---|---|
data-opt-filter | <form> | The data-opt-list ID of the list |
data-opt-filter-field | A control in the form | A field, or * for the slug and every plain field |
data-opt-filter-cmp | The same control | A comparator. The default is eq. |
These attributes ship. The build adds an index of the rows and <script src="/opt-filter.js" defer>. Only pages with a filter form get the script.
Build hints
| Attribute | Goes on | Value |
|---|---|---|
data-opt-compress | An <img> from /assets/ | on or off. No attribute: the site setting. |
data-opt-quality | The same <img> | 50 to 95. No attribute: the site setting. |
data-opt-richtext | <div class="rich-text"> | Marks a Rich text element. The Design panel edits its inside as one piece. |
The build removes all three. For the image settings, see Images.
The page head
| Tag | What it does |
|---|---|
<meta name="splitleaf:status" content="draft"> | The page status: draft or archived. No tag: published. |
<link rel="canonical"> | Your canonical wins. With no tag, the build makes one from the site URL. |
<meta name="robots" content="noindex"> | Also keeps the page out of sitemap.xml |
The build adds og:type, og:url, og:locale, hreflang links and favicon links. It also writes <meta name="generator" content="Splitleaf">.
Attributes that ship
| Attribute | Written by |
|---|---|
data-<axisKey>, for example data-tone="dark" | Component variants |
data-link-type | The link settings: internal, external, section, email, telephone, download |
data-theme | Theme blocks in styles/variables.css, for example [data-theme="dark"] |
data-opt-filter, data-opt-filter-field, data-opt-filter-cmp | Filter forms |
data-splitleaf-list-empty | The build, on a list with no items, so CSS can style the empty state |
Caution: Do not write data-opt-ui or other data-opt-ui-* attributes in a site file. The App uses them only in the Design panel. If one reaches a file, it ships.