Every function available in a template — the Scriban built-ins we support, and the heavendata additions — with where each one is documented.
The functions a template can call. Two groups: the Scriban built-ins we make available, and the heavendata functions we add for product data. The heavendata functions for assets, translatable attributes and custom entities are documented on those pages, next to the data they read; the index below lists all of them.
Scriban built-ins
Section titled “Scriban built-ins”These namespaces are available in every template. They behave exactly as Scriban documents them, so we link out for the individual functions rather than restating them.
| Namespace | What it does | Reference |
|---|---|---|
array |
Sort, filter, join, take, and other list operations | array functions |
date |
Format and calculate with dates | date functions |
html |
Escape, strip and encode HTML | html functions |
math |
Round, format, and arithmetic helpers | math functions |
object |
Inspect and convert values | object functions |
regex |
Match, replace and split with regular expressions | regex functions |
string |
Trim, pad, case, truncate, split, replace | string functions |
timespan |
Durations | timespan functions |
The ones that come up constantly in product templates:
{{ record.description | html.escape }}{{ record.product_name | string.truncate 60 }}{{ record.price | math.format '0.00' }}{{ record.release_date | date.to_string '%F' }}date.to_string takes the same format strings as Scriban’s date.to_string — %F gives 2026-09-03.
heavendata functions
Section titled “heavendata functions”Four namespaces we add. These are specific to product data and are not in Scriban’s documentation.
Every heavendata function
Section titled “Every heavendata function”| Function | What it does | Documented |
|---|---|---|
asset.url |
The public URL of an asset, optionally for an image variant | Assets |
asset.updated |
When an asset was last modified | Assets |
i18n.t |
A translatable attribute’s value in one language, with a fallback | Translatable attributes |
i18n.has |
Whether a translatable attribute has an entry for exactly that language | Translatable attributes |
export.culture_codes · export.language_codes |
The languages in this channel | Translatable attributes |
export.culture_code_uc |
A culture code with an underscore: en-US → en_US |
Translatable attributes |
export.attr_label |
An attribute’s label in one language | Translatable attributes |
export.xml_attr_labels |
An attribute’s label in every channel language, as XML attributes | Translatable attributes |
export.load_custom_entities |
Every custom entity record a reference attribute links to | Custom entities |
export.custom_entity |
Look custom entity records up by any attribute — .get, .find, .key |
Custom entities |
export.attribute |
Every configured attribute’s metadata | Data |
export.variants_by |
Group the product’s variants by an attribute | below |
export.collect_attribute_values |
Every distinct value of an attribute across variants | below |
export.account_id |
Your account’s internal id | below |
export.xmlize |
Escape a value for XML | below |
export.sanitize_filename |
Make a string safe as a file name | below |
export.to_sorting_number |
Turn a string into a sortable integer | below |
export.sv_additional_information |
SmartView additionalInformation elements |
below |
debug.dump |
Print every value the template can reach | below |
Variants
Section titled “Variants”export.variants_by
Section titled “export.variants_by”Group the current product’s variants by an attribute, and reach each group’s variants through _variants. Written for the common case of grouping by color and listing sizes underneath.
{{ for color in export.variants_by 'color_code' }} <color code="{{ color.color_code }}"> {{ for v in color._variants }} <size>{{ v.size }}</size> {{ end }} </color>{{ end }}Each group also carries the values of its first variant, so color.color_name works without reaching into _variants. Variants that have no color_code are not dropped — they form one group whose key is empty, so the template above emits <color code=""> around them.
export.collect_attribute_values
Section titled “export.collect_attribute_values”Every distinct value of an attribute across a list of variants — for a summary line such as all sizes a product comes in.
{{ variants | export.collect_attribute_values 'size' | array.join ', ' }}Pass true as a second argument to flatten values that are themselves lists.
The channel run
Section titled “The channel run”export.account_id
Section titled “export.account_id”Your account’s internal id — useful as a stable identifier in a feed header.
<feed account="{{ export.account_id }}">Escaping and strings
Section titled “Escaping and strings”export.xmlize
Section titled “export.xmlize”Escapes &, <, >, ' and " so a value is safe inside an XML document. Use it on every value you place in XML — a single ampersand in a product name produces an invalid file.
<name>{{ record.product_name | export.xmlize }}</name>For HTML, use Scriban’s html.escape.
export.sanitize_filename
Section titled “export.sanitize_filename”Replaces characters that are not valid in a file name with underscores.
<file>{{ record.product_name | export.sanitize_filename }}.pdf</file>export.to_sorting_number
Section titled “export.to_sorting_number”Turns a string into an integer usable as a sort key. Empty values give 0.
<sort>{{ record.sku | export.to_sorting_number }}</sort>export.sv_additional_information
Section titled “export.sv_additional_information”Builds SmartView additionalInformation XML elements for an attribute, one per channel language. Specific to SmartView output — ignore it unless you are building that format.
{{ export.sv_additional_information 'color' 1 }}Debugging
Section titled “Debugging”debug.dump
Section titled “debug.dump”Prints all available template data as formatted JSON. The fastest way to find out what you can actually reach. See testing and debugging.
Limits
Section titled “Limits”| Loop iterations | 100,000 per top-level loop, counted afresh per record |
| File system access | None — see the caution at the top of this page |

