2023-01-05 18:23:21 +00:00
|
|
|
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
|
|
|
|
2022-10-16 16:49:52 +01:00
|
|
|
{{- $images := .Resources.ByType "image" -}}
|
2022-12-02 22:32:37 +00:00
|
|
|
{{- $featured := $images.GetMatch "*background*" -}}
|
|
|
|
{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
|
2022-10-16 16:49:52 +01:00
|
|
|
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
2024-02-13 21:25:46 +00:00
|
|
|
|
2024-02-10 17:54:51 +00:00
|
|
|
{{ if and .Params.featureimage (not $featured) }}
|
2024-02-05 16:02:40 +09:00
|
|
|
{{- $url:= .Params.featureimage -}}
|
2024-02-10 17:54:51 +00:00
|
|
|
{{ $featured = resources.GetRemote $url }}
|
2024-02-10 23:04:54 +09:00
|
|
|
{{ end }}
|
2024-02-13 21:25:46 +00: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-11-22 12:55:24 +02:00
|
|
|
{{ $isParentList := eq (.Scratch.Get "scope") "list" }}
|
2022-12-02 22:32:37 +00: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 12:55:24 +02: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 16:49:52 +01:00
|
|
|
{{- with $featured -}}
|
2024-03-09 23:44:14 +00:00
|
|
|
|
2022-11-22 12:55:24 +02:00
|
|
|
{{ if $shouldAddHeaderSpace | default true}}
|
2022-11-06 23:16:52 +00:00
|
|
|
<div id="hero" class="h-[150px] md:h-[200px]"></div>
|
2022-11-20 15:14:18 +02:00
|
|
|
{{ end }}
|
2024-03-09 23:44:14 +00:00
|
|
|
|
|
|
|
{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}}
|
2023-01-05 18:23:21 +00:00
|
|
|
{{ with . }}
|
|
|
|
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
|
2022-11-06 00:59:44 +00:00
|
|
|
style="background-image:url({{ .RelPermalink }});">
|
2023-01-05 18:23:21 +00:00
|
|
|
{{ end }}
|
|
|
|
{{ else }}
|
2024-08-08 02:00:47 +02:00
|
|
|
{{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
|
2023-01-05 18:23:21 +00:00
|
|
|
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
|
|
|
|
style="background-image:url({{ .RelPermalink }});">
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
|
2022-11-06 00:59:44 +00: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 21:48:45 +00:00
|
|
|
<div
|
2023-01-15 00:39:38 +00: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-06 00:59:44 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-02 22:32:37 +00:00
|
|
|
{{ if $shouldBlur | default false }}
|
2022-11-06 01:45:53 +00: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-06 00:59:44 +00: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 19:05:01 +00:00
|
|
|
background_blur.style.opacity = (scroll / 300)
|
2022-11-06 00:59:44 +00:00
|
|
|
});
|
|
|
|
</script>
|
2022-11-05 21:48:45 +00:00
|
|
|
{{ end }}
|
2022-11-13 23:28:38 +00:00
|
|
|
{{- end -}}
|