Is there a better (shorter) way of writing this?

{%- if config.extra.meta_position %}{%- if config.extra.meta_position == “bottom” %}

…do stuff

{%- endif %}{%- endif %}

I write it this way so that if the value does not exist in config.toml then zola can still build, but I am wondering if there might be a better way to write this.

I am not sure there is a way around this currently.

Currently the following compiles without errors but does not produce any output

{% if config.extra.notfound | default(value=“no”) == “no” %}

NO


{% else %}

YES


{% endif %}

But this is such a common pattern that I wonder if Tera should support a keyword (eg “with” not sure it is worth doing just for this) or a built-in function like the existing default filter
eg

{% if default(config.extra.meta_position, “top”) == “bottom” %} … {% endif %}

this will evaluate to if "top" =="bottom"

@keats

{%- if config.extra.meta_position and config.extra.meta_position == “bottom” %} {% endif %} should work?

indeed… I guess I understood the question as avoiding the duplicate mention of
config.extra.meta_position