Any way to override view_mode in twig directly? For some reasons, I need to render a content twice, the first one in default view mode, the second one with thumbnail view mode.

In field--paragraph--field-slide--gallery.html.twig I tried to use the following code, however, got a fatal error.

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

{% for item in items %}
  {% set item.content['#view_mode'] = 'thumbnail' %}
  {{ item.content }}
{% endfor %}


Any another idea to get the similar output?
The fatal error is because Twig set is not able to manipulate arrays. This is only possible by using merge and then only on the top level of the array.

So first get the sub array where the key is placed and then merge the array key:

{% set item_content = item.content %}
{% set item_content = item_content|merge({'#view_mode': 'thumbnail'}) %}
{{ item_content }}


But I doubt that after you've solved the Twig issue this will work, because of how entities are rendered and cached. So you might have more success with Twig Tweak.