Welcome back, {{ user.name }}!
Last login: {{ user.last_login | date(format="%Y-%m-%d") }}
Welcome, visitor!
You are visitor number {{ visitor_count }}
Welcome to our site!
{{ item.title }}
{{ item.description | truncate(length=100) }}
{% if item.tags %} {% endif %}Items ({{ items | length }})
{% for item in items %} {{ self::render_item(item=item, featured=item.id == featured_id) }} {% if not loop.last %}{% endif %} {% endfor %}
The syntax {{ variable }} will not be processed in raw blocks.
Neither will {% control %} structures.
{% endraw %}
{# Includes #}
{% include "partials/footer.tera" %}
{# Inheritance example #}
{% block content %}
This is the default content.
{% endblock content %} {# Set variables #} {% set text_color = dark_mode ? "#fff" : "#333" %} {% set items_count = items | length %}
We have {{ items_count }} items.
{# Filters with complex expressions #}
{{ "Hello, " ~ user.name | default(value="Guest") | upper }}
{{ items | filter(attribute="featured", value=true) | length }} featured items
{# With statement #} {% with %} {% set local_var = "Only visible in this scope" %}{{ local_var }}
{% endwith %} {# Mathematical operations #}Price: ${{ price }}
Tax ({{ tax_rate * 100 }}%): ${{ price * tax_rate }}
Total: ${{ price * (1 + tax_rate) }}
Admin panel
{% endif %}