---
title: 'Get first page image in TWIG with "width: 100%" style applied'
url: 'https://getgrav.org/forum/themes-styling/get-first-page-image-in-twig-with-width-100-style-applied-t5736'
markdown: 'https://getgrav.org/forum/themes-styling/get-first-page-image-in-twig-with-width-100-style-applied-t5736.md'
date: '2026-06-21'
description: '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 }}">{{'
---

[Themes & Styling](https://getgrav.org/forum/themes-styling)

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

 Solved by Paul Massendari [View solution](https://getgrav.org/forum/themes-styling/get-first-page-image-in-twig-with-width-100-style-applied-t5736#post-19835)

  Started by Usk70 9 years ago · 3 replies · 2274 views    

 [9 years ago](https://getgrav.org/forum/themes-styling/get-first-page-image-in-twig-with-width-100-style-applied-t5736#post-19831 "Permalink") 

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 }}">{{ page.media[0].html('{{ post.title }}', '{{ page.title }}', 'full-width') }}</a>`
(with a CSS file with 100% width applied).

and

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

without success.

Any tips? Thanks.

 [9 years ago](https://getgrav.org/forum/themes-styling/get-first-page-image-in-twig-with-width-100-style-applied-t5736#post-19833 "Permalink") 

are you sure it should be page.media.images.url ? try this one, for me it works perfectly:
page.header.image\[0\]|first.path

 👍 1 

 [9 years ago](https://getgrav.org/forum/themes-styling/get-first-page-image-in-twig-with-width-100-style-applied-t5736#post-19834 "Permalink") 

or page.header.image\[0\] only

 👍 1 

 [9 years ago](https://getgrav.org/forum/themes-styling/get-first-page-image-in-twig-with-width-100-style-applied-t5736#post-19835 "Permalink")  Solution 

{{page.media.images|first.url }} will do the trick

 👍 1 

[Log in](https://getgrav.org/login?return=%2Fforum%2Fthemes-styling%2Fget-first-page-image-in-twig-with-width-100-style-applied-t5736) to reply.

###  Suggested topics

 | Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| [Modular Page Background Image Display](https://getgrav.org/forum/themes-styling/modular-page-background-image-display-t9486)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by TomW, 2 weeks ago |  | 2 | 200 | [2 days ago](https://getgrav.org/forum/themes-styling/modular-page-background-image-display-t9486 "by TomW") |
| [Inheriting a Theme does not quite work correctly](https://getgrav.org/forum/themes-styling/inheriting-a-theme-does-not-quite-work-correctly-t9501)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by themetman, 3 days ago |  | 0 | 48 | [3 days ago](https://getgrav.org/forum/themes-styling/inheriting-a-theme-does-not-quite-work-correctly-t9501 "by themetman") |
| [\[quark\] mobile menu as the modular page menu](https://getgrav.org/forum/themes-styling/quark-mobile-menu-as-the-modular-page-menu-t1132)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by Bruno, 4 years ago |  | 4 | 1321 | [3 days ago](https://getgrav.org/forum/themes-styling/quark-mobile-menu-as-the-modular-page-menu-t1132 "by AH") |
| [Grav2 with Quark2 – All pages in the hamburger-menu of a one-pager](https://getgrav.org/forum/themes-styling/grav2-with-quark2-all-pages-in-the-hamburger-menu-of-a-one-pager-t9485)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by AH, 2 weeks ago |  | 0 | 173 | [2 weeks ago](https://getgrav.org/forum/themes-styling/grav2-with-quark2-all-pages-in-the-hamburger-menu-of-a-one-pager-t9485 "by AH") |
| [Is it a way to get the "content - summary" in a twig template ?](https://getgrav.org/forum/themes-styling/is-it-a-way-to-get-the-content-summary-in-a-twig-template-t9431)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by FrViPofm, 2 months ago |  | 4 | 668 | [1 month ago](https://getgrav.org/forum/themes-styling/is-it-a-way-to-get-the-content-summary-in-a-twig-template-t9431 "by Paul Hibbitts") |
