Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Call hero image from parent blog page to post

Solved by Jayesh Gohel View solution

Started by Pedro Oliveira 8 years ago · 2 replies · 830 views
8 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

8 years ago Solution

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

Suggested topics

Topic Participants Replies Views Activity
Support · by TomW, 2 weeks ago
8 227 8 hours ago
Support · by alex, 2 months ago
8 667 23 hours ago
Support · by Supple, 5 days ago
1 98 1 day ago
Support · by TomW, 1 week ago
3 159 3 days ago
Support · by TomW, 6 days ago
2 106 5 days ago