I'm trying to only include some HTML based on an IF statement:
{% if "{{ app.request.attributes.get('var_name') }}" != "" %}
<meta id="var_name" content="{{ app.request.attributes.get('var_name') }}" />
{% endif %}
The above will work exactly as expected if the var_name variable holds data, but if it is empty or not defined it always returns the HTML like this:
<meta id="var_name" content="" />
...so basically it is registering the IF statement as true, even though there's nothing to show.
It makes no difference if the variable is defined or not.
Also, this:
{% if {{ app.request.attributes.get('var_name') }} != "" %}
...returns this error:
A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{" in...
How do I do it?