Add targeted specificity to your Drupal content type using taxonomy

June 8, 2017

Drupal allows you to use taxonomy to reference in Content Reference Terms. You can even add multiple taxonomy references and iterate through that list of terms to find the id of a specific term and have twig add some attributes.  Here is an example,

after your outer wrapper call for the value in node.field_content reference terms

this will look through the array. If you want to give an attribute to a specific term, just add some logic for that target_id
add your attribute
and repeat as needed
Tags: Drupal 8, Twig,