Language
Values
The types templates work with, and how they print.
Kiln works with ordinary JavaScript values. Your data goes into a template as it is, with no conversion.
Types
| Kiln | JavaScript |
|---|---|
| null | null or undefined. Kiln treats them the same |
| boolean | true or false |
| number | A number. There is no separate integer type |
| string | A string |
| array | An Array |
| hash | A plain object, or a Map with string keys |
| set | A Set |
| date | A Date |
| markup | A string marked safe to output. See Escaping |
| object | A class instance that opts in. See Safe markup and classes |
True and false
Conditions such as if treat these values as false: null, false, 0, NaN, "", an empty array, an empty hash, and an empty set or map. Everything else is true, including "0" and " ".
page.kiln
{% if tags %}Has tags{% else %}No tags{% endif %}
{% if title %}Has a title{% endif %}
Output
No tags
Has a title
Printing values
When you output a value, Kiln turns it into a string:
| Value | Output |
|---|---|
| null | Nothing |
| boolean | true or false |
| number | The number, as JavaScript writes it |
| string | The string, escaped |
| date | An ISO 8601 date, such as 2026-10-15T09:30:00.000Z |
| array, hash, set | An error. Use join, json or a loop |
Printing an array is an error rather than a silent "[object Object]", so mistakes show up straight away. Use json to print data for debugging.
Empty values
Some features check whether a value is empty rather than false. A value is empty if it is null, false, "", an empty array, an empty hash, or an empty set or map. Unlike false values, 0 is not empty.
page.kiln
{{ stock|default("Unknown") }}
{{ name|default("Anonymous") }}
Output
0
Anonymous