Twig theming boolean issue I have a boolean for the status of a page on whether it is new or not. If it's selected, I want the following code to take effect.  

{% if fields.field_new.content %}
  &lt;div class="info--details__new"&gt;
    {{ fields.field_new.content }}
  &lt;/div&gt;
{% endif %}


This works fine for when it's selected. However, if I unselect it, it still displays the div with the info--details__new class only empty.

I'd like for this div to not be displayed when this boolean isn't selected but can't seem to figure out how to do this in my twig template.

What's the best way to go about doing this so that my empty div doesn't show up when the boolean is unselected?

This is in my views-view-fields--VIEW-NAME.html.twig file.
As discussed in the linked topic use database values to check for booleans in a condition. In a View template you'll find for each row the entity the row is based on in row._entity, from which you can get the raw field values:

{% if row._entity.field_new.value %}
  &lt;div class="info--details__new"&gt;
    {{ fields.field_new.content }}
  &lt;/div&gt;
{% endif %}


Even if it works with debugging turned off, you still depend on how you've configured the rendered output and this is not good practice, if a small change in UI can break the code.