Get first page image in TWIG with "width: 100%" style applied

I am trying to get the first page folder image inside a twig template with a “width: 100%” CSS style applied.

I have tried both:

<a href="{{ page.url }}">{{[0].html('{{ post.title }}', '{{ page.title }}', 'full-width') }}</a>
(with a CSS file with 100% width applied).


<a href="{{ page.url }}"><img src="{{[0].url }}" alt="{{ page.title }}" style="width: 100%" /></a>

without success.

Any tips? Thanks.

are you sure it should be ? try this one, for me it works perfectly:

1 Like

or page.header.image[0] only

1 Like

{{|first.url }} will do the trick

1 Like