blowfish/layouts/partials/hero/basic.html
Aakash Nand 19520b4481 Ensure featureimage is present before calling resources.GetRemote
Also added ability to set author image as external url and updated
relevant documentation in configuration
2024-02-10 23:52:52 +09:00

20 lines
No EOL
900 B
HTML

{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{ if .Params.featureimage }}
{{- $url:= .Params.featureimage -}}
{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}}
{{ end }}
{{- with $featured -}}
{{ if $disableImageOptimization }}
{{ with . }}
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ else }}
{{ with .Resize "1200x" }}
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ end }}
{{- end -}}