Access A Referenced Node's Fields - Field Level Templating I have a content type with a reference field to another content type. This allows an unlimited amount of entries.

I've created a template for this field:
field--node--field-my-fields.html.twig

I want to be able to access the fields of my referenced node. Usually you can do this by accessing the entity, but I can't seem to do this.

{% for item in items %}
  {{ kint(item.content) }}
{% endfor %}


I feel like this should be really simple, but I just can't find a way to get access to the fields!

Thanks in advance for any answers.
In item.content is a render array and usually you can access a referenced entity in a '#' key (for most display settings):

{{ item.content['#node'].field_name.value }}


Field Object

Another way to get the field values is using the field object in element['#items'] and loop through the FieldItemList:

{% for item in element['#items'] %}
    {{ item.entity.field_name.value }}
{% endfor %}


Then you are independent from the display settings of the field.

For background information see this blog post from Berdir https://www.md-systems.ch/blog/techblog/2017/02/20/twig-and-entity-field-api-or-how-to-take-control-of-nodehtmltwig for the difference between formatted output and the underlying objects. In a field template you don't need to go back to the parent node object, because you can access directly the field object. You can get the parent node from element['#object'] though, if you want to access other fields.