From dbc1be30213d559a6454c3a024bc33901dab4dfb Mon Sep 17 00:00:00 2001 From: hossainemruz Date: Wed, 2 Nov 2022 23:55:04 +0600 Subject: [PATCH] Look for hero image in page bundle Signed-off-by: hossainemruz --- layouts/partials/helpers/get-hero.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/layouts/partials/helpers/get-hero.html b/layouts/partials/helpers/get-hero.html index ece8a89..00d5b47 100644 --- a/layouts/partials/helpers/get-hero.html +++ b/layouts/partials/helpers/get-hero.html @@ -3,7 +3,12 @@ {{/* if hero image is specified in the page front-matter, then use that */}} {{ if .Params.hero }} - {{ $heroImage = resources.Get .Params.hero }} + {{/* try to read from the page bundle */}} + {{ $heroImage = .Resources.Get .Params.hero }} + {{/* if the image does not exist in the page bundle,try looking in the assets folder */}} + {{ if not $heroImage }} + {{ $heroImage = resources.Get .Params.hero }} + {{ end }} {{ end }} {{ .Scratch.Set "heroScratch" $heroImage }}