Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Call hero image from parent blog page to post

Solved by Jayesh Gohel View solution

Started by Pedro Oliveira 8 years ago · 2 replies · 649 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 gravinator, 1 month ago
5 452 1 hour ago
Support · by stell, 7 days ago
4 238 5 days ago
Support · by Gravver, 2 weeks ago
6 279 1 week ago
Support · by Marcel, 4 weeks ago
2 338 1 week ago
Support · by blu3prince, 2 weeks ago
1 254 2 weeks ago