Default template engine
The default template engine has simple intuitive syntax inspired by twig an liquid.
Variables
Variables are escaped by default
{{ variable }}
{{ node.meta.title }}
Printing the unescaped content of a variable.
{{ variable | raw }}
assign variables
{% assign variable = 5 %}
if-elseif-else
{% if <expression> %}
{% elseif <expression> %}
{% else %}
{% endif %}
for
{% for item in items %}
{{ look.index }}
{% endfor %}
include
{% include 'fragement.html' %}
macros
Definition and usage of a macro
{% macro hello(name) %}
Hello {{ name }}
{% endmacro %}
{{ hello('CondationCMS') }}
Or import the macro in another template
{% import 'macros.html' %}
{{ hello('CondationCMS') }}
layouts with extends and blocks
in base template
{% block header %}
{% endblock %}
{% block content %}
{% endblock %}
in child template
{% extends 'base.html' %}
{% block header %}
Override default block
{% endblock %}
{% block content %}
Override default block
{% endblock %}