Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Call hero image from parent blog page to post

Solved by Jayesh Gohel View solution

Started by Pedro Oliveira 7 years ago · 2 replies · 380 views
7 years ago

Hi,

I need to show the hero image from blog main page in the children posts.
I can call the first image in the page media, with:

{% set page = page.find('/news') %}
{% set hero_image = page.media.images|first %}

But what I need is to call the selected image in the hero_image field.
The line below doesn't work.

{% set hero_image = page.header.hero_image %}

What am i missing?..
Any help is appreciated.

Thanks
Pedro

7 years ago Solution

You can try page.media.images[page.header.hero_image].

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 57 14 hours ago
Support · by Anna, 3 days ago
2 65 17 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago