What are the Drupal 8 Node class fields (field names)?

I was just trying to modify one of my Drupal 8 template files — node.html.twig — and I couldn’t find any good documentation for what variables/values/fields are in the Drupal 8 Node class, so I dumped some output to my browser, and saw that these are the Node fields:

Node Fields
-----------
nid
uuid
vid
langcode
type
title
uid
status
created
changed
promote
sticky
revision_timestamp
revision_uid
revision_log
revision_translation_affected
default_langcode
path
body

Note that if you want to access one of these fields — such as the type field — you need to refer to it using a “get” method, like this:

{{ node.getType }}

There’s a little documentation on this on the drupal.org node.html.twig reference page.

I have a really hard time reading the Drupal class documentation, but here’s a link to the Drupal 8 Node class docs.

Node 'content' fields

In a related note, the content variable in a Node page (node.html.twig) has these fields:

Node 'content' variable fields
------------------------------
body
category
tags
comment

I show how you can see these fields next.

How I dumped the Node class field names

I have been having “out of memory” errors when trying to use dump or kint with Drupal 8 and Twig, so I dumped the Node fields to my browser with this Twig code snippet:

<ol>
    {% for key, value in node %}
      <li>{{ key }}</li>
    {% endfor %}
</ol>

As I mentioned at the beginning of this post, I put that code in my Drupal 8 Twig node.html.twig template file, and it printed out the results shown. When working in node.html.twig, you can replace node with content in that loop to see what fields the content variable contains.