set

Save a value to use later in the template.

View Markdown

Syntax

{% 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 set tag produces no output and needs no closing tag.