Expressions
Expressions are the values used inside {{ }}, {! !}, and {% %} constructs. The engine supports six expression types.
VariableExpression
Resolves a named variable from the template data bag. Supports dot notation for nested access.
{{ title }}
{{ post.title }}
{{ post.author.name }}
{{ options.count }}
Dot traversal works on both arrays and objects. If any segment in the chain is null or undefined, the entire expression resolves to an empty string (no error).
{{ post.author.profile.bio }}
{# resolves safely even if author or profile is null #}
LiteralExpression
String literals (double-quoted) and integer literals.
{{ "Hello, World" }}
{{ 42 }}
String literals are used as filter arguments and tag function arguments:
{{ post.published_at | date "M d, Y" }}
{! site_url "blog" !}
{! lang "Common.read_more" !}
ComparisonExpression
Binary comparison returning boolean. Used in {% if %} conditions.
| Operator | Meaning |
|---|---|
== | Equal |
!= | Not equal |
< | Less than |
> | Greater than |
<= | Less than or equal |
>= | Greater than or equal |
{% if post.status == "published" %}
{% if options.count > 5 %}
{% if post.view_count >= 1000 %}
{% if post.id != excluded_id %}
Comparisons are loosely typed (PHP == semantics). The string "5" equals the integer 5.
BooleanExpression
Combines two expressions with and or or.
{% if user and user.is_active %}
{% if post.is_featured or post.is_sticky %}
{% if options.show_date == "1" and post.published_at %}
and and or are evaluated left to right with short-circuit semantics: in A and B, if A is falsy B is not evaluated.
NotExpression
Negates a boolean expression.
{% if not post.is_premium %}
{% if not options.hide_title %}
{% if not errors %}
not has higher precedence than and/or. Use parentheses to override (parenthetical grouping is supported in conditions):
{% if not (post.is_premium or post.is_draft) %}
FilterExpression
A VariableExpression followed by one or more filter applications. The result of a FilterExpression is the filtered value.
{{ post.published_at | date "M d, Y" }}
{{ post.body | strip_tags | excerpt 160 }}
{{ user.email | strtolower | md5 }}
{{ options.title | default "Untitled" }}
Filters are applied in left-to-right order. Each filter receives the result of the previous filter. The final filtered value is then HTML-escaped (in {{ }}) or emitted raw (in {! !}).