set
Save a value to use later in the template.
Syntax
1{% set name = expression %}Usage
- Give a value a name, then use
{{ name }}later in the template. Filters can be applied. - Using the same name again replaces its value.
- Values set inside a loop only last for the current item.
- The
settag produces no output and needs no closing tag.
Example
Open in Playground| Data | |
|---|---|
| Template | |
| Output | |