Fix to the hero so you can have the image named anything you want (#248)
* Fix to the hero so you can have the image named anything you want * Keep backward compatibility Signed-off-by: hossainemruz <hossainemruz@gmail.com> Co-authored-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
parent
4bea73b882
commit
88895c50c2
1 changed files with 5 additions and 0 deletions
|
@ -1,5 +1,10 @@
|
|||
{{/* check if there is any hero image in the same folder as the markdown file */}}
|
||||
{{ $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 */}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue