Skip to content

Template channels

Render a channel's output with your own template, when the receiving system needs an exact document shape.

A template channel renders its output with a template you write, instead of a fixed table format. Use one when the receiving system specifies an exact document shape — an XML file to a schema, a JSON structure, or a text layout that has to match character for character.

Saving a template change keeps the version it replaces, so a change you regret can be undone by restoring an earlier version of the channel — see Versions.

In Channels, select New channel, then select Create on one of the template cards:

Card One record per Content type of the output
Template product feed product application/xml
Template “‹entity›” feed — one card per custom entity record of that custom entity application/xml — text/plain for a channel created from this card before 4 September 2026

The editor of a template channel has no Feeds step — a template channel always has exactly one feed — and no Format step. In their place it shows Header template, Record template, Footer template and Options.

The content type is fixed by the card, and the editor has no field to change it. The file is named with a .txt extension unless you set File name under Options.

A template channel has three templates, and they run at different times:

Template Runs What it can use
Header Once, before any products The Scriban built-ins only — no product data and no heavendata functions
Record Once per product (or per custom entity record) record and variants, and every function
Footer Once, after all products The Scriban built-ins only — no product data and no heavendata functions

The record template’s editor helps you find a field. On a Scriban channel its toolbar has Insert field: search the feed’s fields and choose one, and it is inserted at the cursor as {{ record.‹code› }}, or as record.‹code› inside a {{ }} already there. Typing inside {{ }} also completes the feed’s fields and every heavendata function. Both insert the plain field, so a translatable, asset or reference field still needs the function its page describes — the data in a template lists them. The header and footer templates complete only Scriban’s keywords and an if/else block, and a Liquid channel has neither help.

A minimal XML feed, split across the three:

<!-- Header -->
<?xml version="1.0" encoding="utf-8"?>
<products>
<!-- Record -->
<product>
<sku>{{ record.sku }}</sku>
<name>{{ record.product_name | export.xmlize }}</name>
</product>
<!-- Footer -->
</products>

Templates are written in Scriban. Everything in this documentation is Scriban.

Under Options, the channel has a Template language setting with two values, Scriban (recommended) and Liquid. Liquid is legacy and only partially supported. We do not document it, and the examples on this site are written and tested for Scriban only — Liquid’s control flow ({% if %}) is different, so do not expect them to work unchanged.

A new channel is Scriban, from either card — the cards say Scriban template formatted. The toolbar above each template shows the language the template runs as, for example Template language: Scriban.

An older channel can be on Liquid without anyone having chosen it:

Channel What Options → Template language shows What to do
Created before the setting existed Liquid Switching means rewriting its templates — Duplicate the channel from the channels list and convert the copy
Created from a Template “‹entity›” feed card before 4 September 2026 Liquid If its templates are still empty, set Scriban (recommended) and save before you write anything; otherwise convert a copy, as above
Template language basics The syntax: outputting values, conditions, loops, and filters
The data in a template What record and variants contain, how to read a plain attribute, and a product’s categories
Translatable attributes Reading a value in one language, and looping over the channel’s languages
Assets Image, PDF and file URLs, including image variants
Custom entities Reading the records a reference attribute links to
Template function reference Every function available, including the ones we add
Testing and debugging templates See what your template produces before you publish it