mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
feat: add support for imagePosition config
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||||
|
|
||||||
|
{{ $useDefault := false }}
|
||||||
{{ $featured := "" }}
|
{{ $featured := "" }}
|
||||||
{{ $featuredURL := "" }}
|
{{ $featuredURL := "" }}
|
||||||
{{ with .Params.featureimage }}
|
{{ with .Params.featureimage }}
|
||||||
@@ -25,8 +26,10 @@
|
|||||||
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
||||||
{{ if $default.url }}
|
{{ if $default.url }}
|
||||||
{{ $featuredURL = $default.url }}
|
{{ $featuredURL = $default.url }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ else if $default.obj }}
|
{{ else if $default.obj }}
|
||||||
{{ $featured = $default.obj }}
|
{{ $featured = $default.obj }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@@ -58,6 +61,11 @@
|
|||||||
<div id="hero" class="h-[150px] md:h-[200px]"></div>
|
<div id="hero" class="h-[150px] md:h-[200px]"></div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom">
|
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom">
|
||||||
|
{{ $style := "" }}
|
||||||
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
||||||
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
||||||
|
{{ $style = printf "object-position: %s;" . }}
|
||||||
|
{{ end }}
|
||||||
<img
|
<img
|
||||||
id="background-image"
|
id="background-image"
|
||||||
src="{{ . }}"
|
src="{{ . }}"
|
||||||
@@ -65,7 +73,8 @@
|
|||||||
loading="eager"
|
loading="eager"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
fetchpriority="high"
|
fetchpriority="high"
|
||||||
class="absolute inset-0 w-full h-full object-cover">
|
class="absolute inset-0 w-full h-full object-cover"
|
||||||
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"></div>
|
class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"></div>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||||
|
|
||||||
|
{{ $useDefault := false }}
|
||||||
{{ $featured := "" }}
|
{{ $featured := "" }}
|
||||||
{{ $featuredURL := "" }}
|
{{ $featuredURL := "" }}
|
||||||
{{ with .Params.featureimage }}
|
{{ with .Params.featureimage }}
|
||||||
@@ -25,8 +26,10 @@
|
|||||||
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
||||||
{{ if $default.url }}
|
{{ if $default.url }}
|
||||||
{{ $featuredURL = $default.url }}
|
{{ $featuredURL = $default.url }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ else if $default.obj }}
|
{{ else if $default.obj }}
|
||||||
{{ $featured = $default.obj }}
|
{{ $featured = $default.obj }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@@ -42,6 +45,11 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with $featuredURL }}
|
{{ with $featuredURL }}
|
||||||
|
{{ $style := "" }}
|
||||||
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
||||||
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
||||||
|
{{ $style = printf "object-position: %s;" . }}
|
||||||
|
{{ end }}
|
||||||
<div class="overflow-hidden h-36 md:h-56 lg:h-72">
|
<div class="overflow-hidden h-36 md:h-56 lg:h-72">
|
||||||
<img
|
<img
|
||||||
src="{{ . }}"
|
src="{{ . }}"
|
||||||
@@ -49,6 +57,7 @@
|
|||||||
loading="eager"
|
loading="eager"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
fetchpriority="high"
|
fetchpriority="high"
|
||||||
class="w-full h-full nozoom object-cover">
|
class="w-full h-full nozoom object-cover"
|
||||||
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||||
|
|
||||||
|
{{ $useDefault := false }}
|
||||||
{{ $featured := "" }}
|
{{ $featured := "" }}
|
||||||
{{ $featuredURL := "" }}
|
{{ $featuredURL := "" }}
|
||||||
{{ with .Params.featureimage }}
|
{{ with .Params.featureimage }}
|
||||||
@@ -25,8 +26,10 @@
|
|||||||
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
||||||
{{ if $default.url }}
|
{{ if $default.url }}
|
||||||
{{ $featuredURL = $default.url }}
|
{{ $featuredURL = $default.url }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ else if $default.obj }}
|
{{ else if $default.obj }}
|
||||||
{{ $featured = $default.obj }}
|
{{ $featured = $default.obj }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@@ -50,6 +53,11 @@
|
|||||||
{{- with .Page.Params.alt }}{{ $alt = . }}{{ end -}}
|
{{- with .Page.Params.alt }}{{ $alt = . }}{{ end -}}
|
||||||
|
|
||||||
{{ with $featuredURL }}
|
{{ with $featuredURL }}
|
||||||
|
{{ $style := "" }}
|
||||||
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
||||||
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
||||||
|
{{ $style = printf "object-position: %s;" . }}
|
||||||
|
{{ end }}
|
||||||
<figure>
|
<figure>
|
||||||
<img
|
<img
|
||||||
src="{{ . }}"
|
src="{{ . }}"
|
||||||
@@ -57,7 +65,8 @@
|
|||||||
loading="eager"
|
loading="eager"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
fetchpriority="high"
|
fetchpriority="high"
|
||||||
class="w-full rounded-lg single_hero_round nozoom">
|
class="w-full rounded-lg single_hero_round nozoom"
|
||||||
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
|
||||||
{{ if $caption }}
|
{{ if $caption }}
|
||||||
<figcaption class="text-sm text-neutral-700 dark:text-neutral-400 hover:underline text-center">
|
<figcaption class="text-sm text-neutral-700 dark:text-neutral-400 hover:underline text-center">
|
||||||
{{ $caption | markdownify }}
|
{{ $caption | markdownify }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
||||||
|
|
||||||
{{/* === Background === */}}
|
{{/* === Background === */}}
|
||||||
|
{{ $useDefault := false }}
|
||||||
{{ $images := .Resources.ByType "image" }}
|
{{ $images := .Resources.ByType "image" }}
|
||||||
{{ $background := $images.GetMatch "*background*" }}
|
{{ $background := $images.GetMatch "*background*" }}
|
||||||
{{ $backgroundURL := "" }}
|
{{ $backgroundURL := "" }}
|
||||||
@@ -9,8 +10,10 @@
|
|||||||
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
||||||
{{ if $default.url }}
|
{{ if $default.url }}
|
||||||
{{ $backgroundURL = $default.url }}
|
{{ $backgroundURL = $default.url }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ else if $default.obj }}
|
{{ else if $default.obj }}
|
||||||
{{ $background = $default.obj }}
|
{{ $background = $default.obj }}
|
||||||
|
{{ $useDefault = true }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@@ -88,13 +91,19 @@
|
|||||||
loading="eager"
|
loading="eager"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
fetchpriority="high"
|
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 }}>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
<div class="single_hero_background nozoom fixed inset-x-0 top-0 h-[800px]">
|
<div class="single_hero_background nozoom fixed inset-x-0 top-0 h-[800px]">
|
||||||
{{ with $backgroundURL }}
|
{{ with $backgroundURL }}
|
||||||
|
{{ $style := "" }}
|
||||||
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
||||||
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
||||||
|
{{ $style = printf "object-position: %s;" . }}
|
||||||
|
{{ end }}
|
||||||
<img
|
<img
|
||||||
id="background-image-main"
|
id="background-image-main"
|
||||||
src="{{ . }}"
|
src="{{ . }}"
|
||||||
@@ -102,7 +111,8 @@
|
|||||||
loading="eager"
|
loading="eager"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
fetchpriority="high"
|
fetchpriority="high"
|
||||||
class="absolute inset-0 h-full w-full object-cover">
|
class="absolute inset-0 h-full w-full object-cover"
|
||||||
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div
|
<div
|
||||||
class="from-neutral absolute inset-0 bg-gradient-to-t to-transparent mix-blend-normal dark:from-neutral-800"></div>
|
class="from-neutral absolute inset-0 bg-gradient-to-t to-transparent mix-blend-normal dark:from-neutral-800"></div>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<div class="mx-auto max-w-7xl p-0">
|
<div class="mx-auto max-w-7xl p-0">
|
||||||
<div class="relative sm:overflow-hidden">
|
<div class="relative sm:overflow-hidden">
|
||||||
<div class="fixed inset-x-0 top-0 -z-10">
|
<div class="fixed inset-x-0 top-0 -z-10">
|
||||||
|
{{ $useDefault := true }}
|
||||||
{{ $homepageImage := "" }}
|
{{ $homepageImage := "" }}
|
||||||
{{ with .Site.Params.defaultBackgroundImage }}
|
{{ with .Site.Params.defaultBackgroundImage }}
|
||||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||||
@@ -16,16 +17,24 @@
|
|||||||
{{ with .Site.Params.homepage.homepageImage }}
|
{{ with .Site.Params.homepage.homepageImage }}
|
||||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||||
{{ $homepageImage = resources.GetRemote . }}
|
{{ $homepageImage = resources.GetRemote . }}
|
||||||
|
{{ $useDefault = false }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $homepageImage = resources.Get . }}
|
{{ $homepageImage = resources.Get . }}
|
||||||
|
{{ $useDefault = false }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $homepageImage }}
|
{{ if $homepageImage }}
|
||||||
|
{{ $style := "" }}
|
||||||
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
||||||
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
||||||
|
{{ $style = printf "object-position: %s;" . }}
|
||||||
|
{{ end }}
|
||||||
<img
|
<img
|
||||||
id="background-image"
|
id="background-image"
|
||||||
class="nozoom mt-0 mr-0 mb-0 ml-0 h-[1000px] w-full object-cover"
|
class="nozoom mt-0 mr-0 mb-0 ml-0 h-[1000px] w-full object-cover"
|
||||||
src="{{ $homepageImage.RelPermalink }}"
|
src="{{ $homepageImage.RelPermalink }}"
|
||||||
role="presentation">
|
role="presentation"
|
||||||
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
|
||||||
<div
|
<div
|
||||||
class="from-neutral absolute inset-0 h-[1000px] bg-gradient-to-t to-transparent mix-blend-normal dark:from-neutral-800"></div>
|
class="from-neutral absolute inset-0 h-[1000px] bg-gradient-to-t to-transparent mix-blend-normal dark:from-neutral-800"></div>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mt-6 sm:mt-16 lg:mt-0 mx-auto max-w-xl px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:py-16 lg:px-0">
|
<div class="mt-6 sm:mt-16 lg:mt-0 mx-auto max-w-xl px-4 sm:px-6 lg:mx-0 lg:max-w-none lg:py-16 lg:px-0">
|
||||||
<div class="-me-48 md:-me-16 lg:relative lg:m-0 lg:h-full lg:px-0 w-full">
|
<div class="-me-48 md:-me-16 lg:relative lg:m-0 lg:h-full lg:px-0 w-full">
|
||||||
|
{{ $useDefault := true }}
|
||||||
{{ $homepageImage := "" }}
|
{{ $homepageImage := "" }}
|
||||||
{{ with .Site.Params.defaultBackgroundImage }}
|
{{ with .Site.Params.defaultBackgroundImage }}
|
||||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||||
@@ -25,14 +26,22 @@
|
|||||||
{{ with .Site.Params.homepage.homepageImage }}
|
{{ with .Site.Params.homepage.homepageImage }}
|
||||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||||
{{ $homepageImage = resources.GetRemote . }}
|
{{ $homepageImage = resources.GetRemote . }}
|
||||||
|
{{ $useDefault = false }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $homepageImage = resources.Get . }}
|
{{ $homepageImage = resources.Get . }}
|
||||||
|
{{ $useDefault = false }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $homepageImage }}
|
{{ if $homepageImage }}
|
||||||
|
{{ $style := "" }}
|
||||||
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
||||||
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
||||||
|
{{ $style = printf "object-position: %s;" . }}
|
||||||
|
{{ end }}
|
||||||
<img
|
<img
|
||||||
class="w-full rounded-xl shadow-xl lg:absolute lg:h-full lg:w-auto lg:max-w-none"
|
class="w-full rounded-xl shadow-xl lg:absolute lg:h-full lg:w-auto lg:max-w-none"
|
||||||
src="{{ $homepageImage.RelPermalink }}">
|
src="{{ $homepageImage.RelPermalink }}"
|
||||||
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<div class="mx-auto max-w-7xl p-0">
|
<div class="mx-auto max-w-7xl p-0">
|
||||||
<div class="relative shadow-xl sm:overflow-hidden rounded-2xl">
|
<div class="relative shadow-xl sm:overflow-hidden rounded-2xl">
|
||||||
<div class="absolute inset-0">
|
<div class="absolute inset-0">
|
||||||
|
{{ $useDefault := true }}
|
||||||
{{ $homepageImage := "" }}
|
{{ $homepageImage := "" }}
|
||||||
{{ with .Site.Params.defaultBackgroundImage }}
|
{{ with .Site.Params.defaultBackgroundImage }}
|
||||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||||
@@ -17,12 +18,22 @@
|
|||||||
{{ with .Site.Params.homepage.homepageImage }}
|
{{ with .Site.Params.homepage.homepageImage }}
|
||||||
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
||||||
{{ $homepageImage = resources.GetRemote . }}
|
{{ $homepageImage = resources.GetRemote . }}
|
||||||
|
{{ $useDefault = false }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $homepageImage = resources.Get . }}
|
{{ $homepageImage = resources.Get . }}
|
||||||
|
{{ $useDefault = false }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $homepageImage }}
|
{{ if $homepageImage }}
|
||||||
<img class="h-full w-full object-cover nozoom mt-0 mr-0 mb-0 ml-0" src="{{ $homepageImage.RelPermalink }}">
|
{{ $style := "" }}
|
||||||
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
||||||
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
||||||
|
{{ $style = printf "object-position: %s;" . }}
|
||||||
|
{{ end }}
|
||||||
|
<img
|
||||||
|
class="h-full w-full object-cover nozoom mt-0 mr-0 mb-0 ml-0"
|
||||||
|
src="{{ $homepageImage.RelPermalink }}"
|
||||||
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }}>
|
||||||
{{ if not $disableHeroImageFilter }}
|
{{ if not $disableHeroImageFilter }}
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0 bg-gradient-to-r from-primary-500 to-secondary-600 dark:from-primary-600 dark:to-secondary-800 mix-blend-multiply"></div>
|
class="absolute inset-0 bg-gradient-to-r from-primary-500 to-secondary-600 dark:from-primary-600 dark:to-secondary-800 mix-blend-multiply"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user