{# This is an example of a comment. #} {# You can use this syntax to write multiline comments as well. #} {# You have the option to access variables from the context passed to the template #} {{ foo }} {# Additionally, you can use a dot (.) to access attributes of a variable or use Python syntax, using [] #} {{ foo.bar }} {{ foo['bar'] }} {# Within the template, you can define variables as well #} {% set name = "Magdiel" %} {{ name }}
{{ key }}
-{{ value }}
{% endfor %}{{ message.content }}
{% elif message.status == "success" %}{{ message.content }}
{% else %}{{ message.content }}
{% endif %} {# file: base.html.j2 #} {% block head %}Welcome to my home homepage.
{% endblock %} {# RESULT #}Welcome to my home homepage.
I'm the {{ name }} and i like to {{ hobby }}.
{# file: index.html.j2 #} {% set name = "Captain Nemo" %} {% set hobby = "navigate through the depths of the ocean" %}I'm the Captain Nemo and i like to navigate through the depths of the ocean.
{{ input(placeholder="Your username") }}
{{ input(type="password") }}