Drupal - Twig get value of field in entity reference
For any type you of field get the value directly like you wrote node.field_name.value. But for reference type you can't get the value directly. For reference type you have to write
ex.:
node.field_team_location.entity.name.value
and for uri u can write: node.field_team_location.entity.uri.value
If you want to render a properly formatted single field of a referenced entity you'll simply have to use the |view filter on the desired field of the referenced node.
Let's say the field_customer
on my parent node references a customer content type entity that holds the customer's address in field_address
.
{{ node.field_customer.entity.field_address|view }}
Use the referenced entity's display settings to define the format of the field you want to render.
Example on drupal.org