diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html index be9d8b78..aa2b231b 100644 --- a/layouts/partials/hero/background.html +++ b/layouts/partials/hero/background.html @@ -1,5 +1,6 @@ {{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }} +{{ $useDefault := false }} {{ $featured := "" }} {{ $featuredURL := "" }} {{ with .Params.featureimage }} @@ -25,8 +26,10 @@ {{ $default := site.Store.Get "defaultBackgroundImage" }} {{ if $default.url }} {{ $featuredURL = $default.url }} + {{ $useDefault = true }} {{ else if $default.obj }} {{ $featured = $default.obj }} + {{ $useDefault = true }} {{ end }} {{ end }} @@ -58,6 +61,11 @@
{{ end }}
+ {{ $style := "" }} + {{ $defaultPosition := cond $useDefault site.Params.imagePosition false }} + {{ with $.Params.imagePosition | default $defaultPosition }} + {{ $style = printf "object-position: %s;" . }} + {{ end }} + class="absolute inset-0 w-full h-full object-cover" + {{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
+ class="w-full h-full nozoom object-cover" + {{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
{{ end }} diff --git a/layouts/partials/hero/big.html b/layouts/partials/hero/big.html index 21179cfe..3fd251d6 100644 --- a/layouts/partials/hero/big.html +++ b/layouts/partials/hero/big.html @@ -1,5 +1,6 @@ {{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }} +{{ $useDefault := false }} {{ $featured := "" }} {{ $featuredURL := "" }} {{ with .Params.featureimage }} @@ -25,8 +26,10 @@ {{ $default := site.Store.Get "defaultBackgroundImage" }} {{ if $default.url }} {{ $featuredURL = $default.url }} + {{ $useDefault = true }} {{ else if $default.obj }} {{ $featured = $default.obj }} + {{ $useDefault = true }} {{ end }} {{ end }} @@ -50,6 +53,11 @@ {{- with .Page.Params.alt }}{{ $alt = . }}{{ end -}} {{ with $featuredURL }} + {{ $style := "" }} + {{ $defaultPosition := cond $useDefault site.Params.imagePosition false }} + {{ with $.Params.imagePosition | default $defaultPosition }} + {{ $style = printf "object-position: %s;" . }} + {{ end }}
+ class="w-full rounded-lg single_hero_round nozoom" + {{ if $style }}style="{{ $style | safeCSS }}"{{ end }}> {{ if $caption }}
{{ $caption | markdownify }} diff --git a/layouts/partials/hero/thumbAndBackground.html b/layouts/partials/hero/thumbAndBackground.html index 6d80ef01..5c18b18c 100644 --- a/layouts/partials/hero/thumbAndBackground.html +++ b/layouts/partials/hero/thumbAndBackground.html @@ -1,6 +1,7 @@ {{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }} {{/* === Background === */}} +{{ $useDefault := false }} {{ $images := .Resources.ByType "image" }} {{ $background := $images.GetMatch "*background*" }} {{ $backgroundURL := "" }} @@ -9,8 +10,10 @@ {{ $default := site.Store.Get "defaultBackgroundImage" }} {{ if $default.url }} {{ $backgroundURL = $default.url }} + {{ $useDefault = true }} {{ else if $default.obj }} {{ $background = $default.obj }} + {{ $useDefault = true }} {{ end }} {{ end }} @@ -88,13 +91,19 @@ loading="eager" decoding="async" fetchpriority="high" - class="w-full h-full nozoom object-cover"> + class="w-full h-full nozoom object-cover" + {{ with $.Params.imagePositionFeature }}style="object-position: {{ . }};"{{ end }}>
{{ end }}
{{ with $backgroundURL }} + {{ $style := "" }} + {{ $defaultPosition := cond $useDefault site.Params.imagePosition false }} + {{ with $.Params.imagePosition | default $defaultPosition }} + {{ $style = printf "object-position: %s;" . }} + {{ end }} + class="absolute inset-0 h-full w-full object-cover" + {{ if $style }}style="{{ $style | safeCSS }}"{{ end }}> {{ end }}
diff --git a/layouts/partials/home/background.html b/layouts/partials/home/background.html index b0090d12..88fbd868 100644 --- a/layouts/partials/home/background.html +++ b/layouts/partials/home/background.html @@ -5,6 +5,7 @@
+ {{ $useDefault := true }} {{ $homepageImage := "" }} {{ with .Site.Params.defaultBackgroundImage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} @@ -16,16 +17,24 @@ {{ with .Site.Params.homepage.homepageImage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $homepageImage = resources.GetRemote . }} + {{ $useDefault = false }} {{ else }} {{ $homepageImage = resources.Get . }} + {{ $useDefault = false }} {{ end }} {{ end }} {{ if $homepageImage }} + {{ $style := "" }} + {{ $defaultPosition := cond $useDefault site.Params.imagePosition false }} + {{ with $.Params.imagePosition | default $defaultPosition }} + {{ $style = printf "object-position: %s;" . }} + {{ end }} + role="presentation" + {{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
+ {{ $useDefault := true }} {{ $homepageImage := "" }} {{ with .Site.Params.defaultBackgroundImage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} @@ -25,14 +26,22 @@ {{ with .Site.Params.homepage.homepageImage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $homepageImage = resources.GetRemote . }} + {{ $useDefault = false }} {{ else }} {{ $homepageImage = resources.Get . }} + {{ $useDefault = false }} {{ end }} {{ end }} {{ if $homepageImage }} + {{ $style := "" }} + {{ $defaultPosition := cond $useDefault site.Params.imagePosition false }} + {{ with $.Params.imagePosition | default $defaultPosition }} + {{ $style = printf "object-position: %s;" . }} + {{ end }} + src="{{ $homepageImage.RelPermalink }}" + {{ if $style }}style="{{ $style | safeCSS }}"{{ end }}> {{ end }}
diff --git a/layouts/partials/home/hero.html b/layouts/partials/home/hero.html index 7fda230f..627de798 100644 --- a/layouts/partials/home/hero.html +++ b/layouts/partials/home/hero.html @@ -6,6 +6,7 @@
+ {{ $useDefault := true }} {{ $homepageImage := "" }} {{ with .Site.Params.defaultBackgroundImage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} @@ -17,12 +18,22 @@ {{ with .Site.Params.homepage.homepageImage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $homepageImage = resources.GetRemote . }} + {{ $useDefault = false }} {{ else }} {{ $homepageImage = resources.Get . }} + {{ $useDefault = false }} {{ end }} {{ end }} {{ if $homepageImage }} - + {{ $style := "" }} + {{ $defaultPosition := cond $useDefault site.Params.imagePosition false }} + {{ with $.Params.imagePosition | default $defaultPosition }} + {{ $style = printf "object-position: %s;" . }} + {{ end }} + {{ if not $disableHeroImageFilter }}