I am overriding the fields template views-view-fields--machine_name.html.twig
.
I want to render some Fields in a different div than the other fields. I do not want the fields to render twice.
<div class="foo">
{{ fields.field_events_date_start.content }}
{{ fields.field_events_date_start_1.content }}
</div>
{% for field in fields -%}
{{ field.separator }}
{%- if field.wrapper_element -%}
<{{ field.wrapper_element }}{{ field.wrapper_attributes }}>
{%- endif %}
{%- if field.label -%}
{%- if field.label_element -%}
<{{ field.label_element }}{{ field.label_attributes }}>{{ field.label }}{{ field.label_suffix }}</{{ field.label_element }}>
{%- else -%}
{{ field.label }}{{ field.label_suffix }}
{%- endif %}
{%- endif %}
{%- if field.element_type -%}
<{{ field.element_type }}{{ field.element_attributes }}>{{ field.content }}</{{ field.element_type }}>
{%- else -%}
{{ field.content }}
{%- endif %}
{%- if field.wrapper_element -%}
</{{ field.wrapper_element }}>
{%- endif %}
{%- endfor %}
If I exclude those Fields from the display in Views it hides them both when they render before and in the normal content area.
{{ content|without('field_events_date_start', 'field_events_date_start_1') }}
...Does not work because I am rendering Fields, not content.
How do I get the fields to render before, but be excluded later?