Skip to content

Conditionals

Use conditionals to render sections conditionally based on context values.

Syntax

{% if subscribed %}
Thanks for subscribing, {{name}}!
{% else %}
Please consider subscribing.
{% endif %}

Rendered results

  • When subscribed is true and name is Dana:
Thanks for subscribing, Dana!
  • When subscribed is false or missing:
Please consider subscribing.

Notes

  • Conditions evaluate truthiness: missing, false, empty, or null values are treated as false.
  • You can reference nested values with dotted paths, e.g. user.active.
  • There is no support for complex expressions — stick to presence and simple boolean checks.

Tip: Use margarita metadata or a dry render to ensure required context keys are present before running in production.