if

Render content when a condition is true.

View Markdown

Syntax

{% if condition %}...{% elseif other %}...{% else %}...{% endif %}

Usage

  • The first condition that is true decides which content is shown.
  • Add elseif to check another condition, or else for content to show when all conditions are false. Both are optional.
  • Close the block with endif.

True and false

  • Conditions treat false, null, undefined, an empty string, 0, and an empty array as false. Other values are treated as true.