2023-01-05 12:23:21 -06:00
|
|
|
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
|
|
|
|
2022-10-16 10:49:52 -05:00
|
|
|
{{- $images := .Resources.ByType "image" -}}
|
2024-03-09 17:44:14 -06:00
|
|
|
{{- $featured := $images.GetMatch "*background*" -}}
|
|
|
|
{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
|
2022-10-16 10:49:52 -05:00
|
|
|
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
2024-03-09 17:44:14 -06:00
|
|
|
|
|
|
|
{{ if and .Params.featureimage (not $featured) }}
|
2024-02-10 08:04:54 -06:00
|
|
|
{{- $url:= .Params.featureimage -}}
|
2024-03-09 17:44:14 -06:00
|
|
|
{{ $featured = resources.GetRemote $url }}
|
2024-02-10 08:04:54 -06:00
|
|
|
{{ end }}
|
2024-03-09 17:44:14 -06:00
|
|
|
|
|
|
|
{{- if not $featured }}
|
|
|
|
{{ with .Site.Params.defaultBackgroundImage }}
|
|
|
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
|
|
|
{{ $featured = resources.GetRemote . }}
|
|
|
|
{{ else }}
|
|
|
|
{{ $featured = resources.Get . }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end -}}
|
|
|
|
|
2022-10-16 10:49:52 -05:00
|
|
|
{{- with $featured -}}
|
2024-03-09 17:44:14 -06:00
|
|
|
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}}
|
2023-01-05 12:23:21 -06:00
|
|
|
{{ 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 }}
|
2024-08-07 19:00:47 -05:00
|
|
|
{{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
|
2023-01-05 12:23:21 -06:00
|
|
|
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
|
|
|
|
{{ end }}
|
2022-10-16 10:49:52 -05:00
|
|
|
{{ end }}
|
|
|
|
{{- end -}}
|