From 7fdeaec2b04b995a23f9fab24d2ceee79b67b642 Mon Sep 17 00:00:00 2001 From: hossainemruz Date: Sat, 13 Mar 2021 19:45:19 +0600 Subject: [PATCH] Keep backward compatibility 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 98ac06e..d253f85 100644 --- a/layouts/partials/helpers/get-hero.html +++ b/layouts/partials/helpers/get-hero.html @@ -1,5 +1,10 @@ {{/* check if there is any hero image in the same folder as the markdown file */}} -{{ $heroImage := .Page.Resources.GetMatch .Params.hero}} +{{ $heroImage := .Page.Resources.GetMatch "hero.{jpg,png,svg}"}} + +{{/* if hero image is specified in the page front-matter, then use that */}} +{{ if .Params.hero }} + {{ $heroImage = .Page.Resources.GetMatch .Params.hero }} +{{ end }} {{ .Scratch.Set "heroScratch" $heroImage }} {{/* if hero image is not provided, then use the default hero image */}}