Templates

The templates in Zotonic are based on the Django Template Language (DTL), using a customized version of the excellent ErlyDTL library. Over the years, Zotonic’s version of ErlyDTL has diverged, adding Zotonic-specific features and more powerful expression possibilities. However, the main template syntax remains the same:

The double accolade/brace construct outputs the value of the variable:

{{ foo }}

Optionally, you can pipe these variables through a so-called filter, which is applied before output:

{{ foo|lower }}

Template tags allow you to express complex constructs like loops and branches:

{% if username == 'Arjan' %} Hi, Arjan {% endif %}

Being a web framework, it is of no surprise that templates are one of the most broad topics in Zotonic. The template manual has therefore been split up into the following sections, each of which addresses a specific template-related topic.

Previous topic

Media file handling

Next topic

Template locations and the lookup system

Versions

Actions