if/else/unless

Description

Boolean logic operations are available on all objects.

Syntax

{% if <condition> %}
  <code>
{% else %}
  <code>
{% endif %}

Examples

{% if feature.title %}
  {{ feature.title }}
{% endif %}

{% unless feature.body %}
  feature has no content
{% else %}
  {{ feature.body }}
{% endunless %}
© 2024 LocomotiveCMS Terms of use Privacy Policy
Back to top