Basic

Separator

Template files are usually plain HTML files with specific internal delimiters wrapping the template syntax. The system has the following 3 types of separators

  1. {{ and }}: used for expression results output
  2. {% and %}: for template structure control
  3. {# and #}: used for comments

Raw content

All content within the raw block is not parsed by the template and is output as is.

{% raw %}
  Hello {{ name }}
{% endraw %}

Blank control

Template control statements will retain line breaks (\n), if you need to remove whitespace at both ends, you need to use the {%- or -%} separator, for example:

{% set my_var = 2 %}
{{ my_var }}

Output


2

Extra first line breaks. If you need to output on one line, use the following code

{% set my_var = 2 -%}
{{ my_var }}

Comment

Template comments need to be wrapped with {# and #}, and anything inside is not output.