You can use the ?? operator (much like in PHP) to assign a default value when a variable is NULL.
The following will print a default title if the title variable is null.
{{ title ?? 'The default title'}} You can also assign your default value to a variable to and use this later in your template.
{% set title = title ?? 'The default title' %}
Add new comment