Drupal 8 views-view-field.html.twig

this is going to be quick and direct. I’m trying to access different content results from a view related with a content type. I’m pretty much a newbie with twig, but I did make it work to access fields.

Example: Content Type: Books Fields: Name, Portrait(Image). Machine Name: field_name – field_image

Let’s say I upload 2 contents called Book 1 and Book 2 based on the content type.

What I want is to display all fields from Book 1 for the moment or Book 2 but not all of the content at the same time.

My effort:

-First attempt: tried this line of code:

<h2>{{view.field.field_name.getvalue(view.result[0])}}</h2>

Works perfectly, it prints index 0 but not working printing the image, because instead it gives me the id.

-Second attempt: tried this line of code:

{{fields.field_image.content}}

This one seems to be the most practical, it works showing the actual picture from the field image, but I dont know how to access only the image for one index(Book 1).

-Third attempt: tried this line of code

{{content.field_image.0}}

This one doesnt work for me at all.

Hopefully somebody would help me with this. Ive been struggling one week with this.

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/22/feed