Output taxonomy term in views unformatted using twig I'd like to output taxonomy terms as html classes for view-rows in the views unformatted template for Drupal 8.

My code:

    {% if title %}
       &lt;h3&gt;{{ title }}&lt;/h3&gt;
    {% endif %}
    {% for row in rows %}
       &lt;div class="taxonomy-term-{{ term.id }}"&gt;
          &lt;div{{ row.attributes }}&gt;
             {{ row.content }}
          &lt;/div&gt;
       &lt;/div&gt;
    {% endfor %}


What am I missing?
You're a little light on details about your setup, but I can make a suggestion based on what I see. I don't know how you're settings the term variable, but row will have access to the node (assuming this is a node view) that represents the row being displayed. You can do something similar to

{{ row.content['#node'].field_tags.getValue().0.target_id }}

(assuming field_tags is your term reference field) to print the referenced term ID.

Edit: just realized how long ago this was asked... Not sure why it was showing at the top of my list. Anyhow, hopefully helpful to someone!