Getting the value of taxonomy field in a node.html.twig template (Drupal 8.x) I'm currently trying to figure out how to get the value of a field of a node in node.html.twig template. The field (machine_name: news) is linked to a taxonomy and multiple values can be selected. I see a lot of threads here on Drupal StackExchange - tried all the solutions, but not a single one fixes my problem.

I'm currently trying:


  {{ node.field_news[0].value }}


But then nothing is printed. When I try:


  {{ node.hasField('news') }}


... the value '1' is printed. So the field is available.
I tried dumping the whole 'node' object using the Twig dump() method, but then I get a white-screen-of-dead due to memory restrictions.

Any idea's what is the correct way? I'm using Drupal 8.3.2
I found the problem. The 'news' field is a multi-value selectable field. The correct way to access the field would be:

{{ content.news.0 }}


Of course, this will only print the first value in the collection, so I created a for loop in the twig template to loop over the different values.

I needed the 'title' and the 'url' of the taxonomy term. This could be retrieved by:

{{ content.news.0['#title'] }}
{{ content.news.0['#url'] }}