How can I distinguish the first image in an image field in a Twig template? I have a custom field formatter for an image field. The Twig template for the image field is the following:

{% for item in items %}
  {{ item.content }}
{% endfor %}


Each image is then formatted by the following template:

&lt;li data-src={{ fullimage }}&gt;&lt;img src="{{ thumbnail }}" /&gt;&lt;/li&gt;


But what I want to do is to format the first image of the field in a different way. I found how I could change the for loop in the template and use loop.first to treat the first image differently. But the formatting I want to change is in the inner template that formats each image, the one I call with item.content. In the outer template for the entire image field I can distinguish the first image, in the inner template I have no idea how to check for that or how to transfer that information from the outer to the inner template.

Any idea on how I can solve this and format only the first image in a different way?
This code in a node.html.twig template will display only the first value of an image field that has multiple values:

{{ content.field_yourfieldname.0 }}


This will only display the second value:

{{ content.field_yourfieldname.1 }}


Source

Edit: apparently that wasn't really the question, my apologies.