diff options
author | Emruz Hossain <hossainemruz@gmail.com> | 2022-11-02 20:56:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 20:56:27 +0300 |
commit | c3f0bd449e4d73648ff278fe3839e94f784210a4 (patch) | |
tree | 956b35983ec74d1b506adaf5451fcbb0e7345517 | |
parent | a16652581b12ad359ee8c8ce9b90780761a1b031 (diff) |
Look for hero image in page bundle (#684)
Signed-off-by: hossainemruz <hossainemruz@gmail.com>
Signed-off-by: hossainemruz <hossainemruz@gmail.com>
-rw-r--r-- | layouts/partials/helpers/get-hero.html | 7 |
1 files changed, 6 insertions, 1 deletions
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 }} |