How to refer to a custom field in a node template? For the basic page content type I added a custom boolean field called field_login_required.

In my node template node--page.html.twig I have

    &lt;h2&gt;{{ title }}&lt;/h2&gt;
    {% if content.field_login_required %}
        {% if user == 0 %}
        &lt;p class="must-login"&gt;You must be logged in to view this page &lt;a href="/user"&gt;Please click here to login&lt;/a&gt;&lt;/p&gt;
        {% else %}
            &lt;p&gt;{{ content.body }}&lt;/p&gt;
        {% endif %}
    {% else %}
        &lt;p&gt;{{ content.body }}&lt;/p&gt;
    {% endif %}


However content.field_login_required is null no matter whether the checkbox is checked or not. To test what was available I used

{{ dump(content|keys) }}


However the result of this is 

array (size=1)
  0 =&gt; string 'body' (length=4)


field_login_required is omitted. Is there anyway to refer to a custom field in a node template?
The issue occurred because 

{{ content.field_login_required }} 


was used. Node should be used in place of content. The proper code is

{{ node.field_login_required.value }}