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" -}}
|
2022-12-02 16:32:37 -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-02-05 01:02:40 -06:00
|
|
|
{{- $url:= .Params.featureimage -}}
|
|
|
|
{{if or $.Site.Params.list.showHero $.Site.Params.term.showHero $.Site.Params.taxonomy.showHero}} {{ $url = default $.Site.Params.homepage.homepageImage $.Site.Params.defaultBackgroundImage }} {{end}}
|
|
|
|
{{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}}
|
2022-11-13 17:28:38 -06:00
|
|
|
{{- if not $featured }}{{ with .Site.Params.defaultBackgroundImage }}{{ $featured = resources.Get . }}{{ end }}{{ end -}}
|
2022-11-22 04:55:24 -06:00
|
|
|
{{ $isParentList := eq (.Scratch.Get "scope") "list" }}
|
2022-12-02 16:32:37 -06:00
|
|
|
{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or
|
|
|
|
(and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList))
|
|
|
|
(and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList))
|
|
|
|
) }}
|
2022-11-22 04:55:24 -06:00
|
|
|
{{ $shouldAddHeaderSpace := $.Params.layoutBackgroundHeaderSpace | default (or
|
|
|
|
(and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (not $isParentList))
|
|
|
|
(and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) ($isParentList))
|
|
|
|
) }}
|
2022-10-16 10:49:52 -05:00
|
|
|
{{- with $featured -}}
|
2022-11-22 04:55:24 -06:00
|
|
|
{{ if $shouldAddHeaderSpace | default true}}
|
2022-11-06 17:16:52 -06:00
|
|
|
<div id="hero" class="h-[150px] md:h-[200px]"></div>
|
2022-11-20 07:14:18 -06:00
|
|
|
{{ end }}
|
2023-01-05 12:23:21 -06:00
|
|
|
{{ if $disableImageOptimization }}
|
|
|
|
{{ with . }}
|
|
|
|
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
|
2022-11-05 19:59:44 -05:00
|
|
|
style="background-image:url({{ .RelPermalink }});">
|
2023-01-05 12:23:21 -06:00
|
|
|
{{ end }}
|
|
|
|
{{ else }}
|
|
|
|
{{ with .Resize "1200x" }}
|
|
|
|
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
|
|
|
|
style="background-image:url({{ .RelPermalink }});">
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
|
2022-11-05 19:59:44 -05:00
|
|
|
<div class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
|
|
|
|
</div>
|
2022-11-05 16:48:45 -05:00
|
|
|
<div
|
2023-01-14 18:39:38 -06:00
|
|
|
class="absolute inset-0 opacity-60 bg-gradient-to-t from-neutral dark:from-neutral-800 to-neutral-100 dark:to-neutral-800 mix-blend-normal">
|
2022-11-05 19:59:44 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-02 16:32:37 -06:00
|
|
|
{{ if $shouldBlur | default false }}
|
2022-11-05 20:45:53 -05:00
|
|
|
<div id="background-blur" class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl"></div>
|
2022-11-05 19:59:44 -05:00
|
|
|
<script>
|
|
|
|
window.addEventListener('scroll', function (e) {
|
|
|
|
var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
|
|
|
var background_blur = document.getElementById('background-blur');
|
2022-11-06 13:05:01 -06:00
|
|
|
background_blur.style.opacity = (scroll / 300)
|
2022-11-05 19:59:44 -05:00
|
|
|
});
|
|
|
|
</script>
|
2022-11-05 16:48:45 -05:00
|
|
|
{{ end }}
|
2022-11-13 17:28:38 -06:00
|
|
|
{{- end -}}
|