Drupal - How to test for a boolean field in a twig template?
You want to look at the raw value, not the render array.
Example:
{% if node.field_foo is not empty %}
This checks if the field exists. The render array won't be useful beyond rendering values.
Don't look at content
- that is simply the render array. Look at the fields in your entity object (node, paragraph, etc). You might want to install Twig XDebug to breakpoint your templates or inspect variables in mytheme.theme
.
You should be able to look at {% if node.field_foo.value ... %}
for equality checking.