What is the best way to hide e.g. a nav bar on certain pages in Timber Twig templates. Have tried wrapping the navbar element in
{% if post.title !== 'foo bar' %}
// show the nav
{% endif %}
But that doesn't work.
You can't use !==
in twig.
You have to use !=
Working snippet: https://twigfiddle.com/9l9lrc
{% set var = 'foo bar' %}
{% if var != 'foo bar' %}
<h2>Nav</h2>
{% else %}
<em>no-nav</em>
{% endif %}