0

Hi I have a view with the machine name news_filter. In the html every content type it's fields are inside a .views-row div. I want to create a template for those specific rows and maybe later also for each field too. But I can't find the right naming conventions to do so.

Does anyone have an idea?

1

1 Answer 1

0

The template name would be views-view-unformatted--news-filter.html.twig, do clear the cache after adding the template file.

In views you cloud use a display with rendered entity display (Content) and a specific viewmode, use the template suggestion for the entity type, e.g. node--news--VIEWMODE.html.twig.

#views-view-unformatted--news-filter.html.twig
{% for row in rows %}
    {{- row.content -}}
{% endfor %}
#node--news--VIEWMODE.html.twig
<div class="news-item">
  <a href="{{ path('entity.node.canonical', {'node': 393}) }}?sort={{ node.id }}" class="use-ajax"
     data-dialog-type="full_screen">
    <article>
      {{ content.field_event_datum }}
      <h3>{{ label }}</h3>
    </article>
    <div class="click"><p>weiterlesen ></p></div>
  </a>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.