Revert "🐛 fix disableImageOptimization usage across all images in theme"

This reverts commit 9cab78a325.
This commit is contained in:
Nuno Coração 2023-01-05 20:51:11 +00:00 committed by GitHub
parent 4453e4add3
commit 5e941be600
16 changed files with 16 additions and 85 deletions

View file

@ -94,6 +94,7 @@ defaultBackgroundImage = "/img/iceland.jpg"
showTableOfContents = true
cardView = false
[term]
showHero = true
heroStyle = "background" # valid options: basic, big, background, thumbAndBackground

View file

@ -1,4 +1,3 @@
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ with .Params.externalUrl }}
<a href="{{ . }}" target="_blank" rel="external" class="min-w-full">
{{ else }}
@ -14,14 +13,8 @@
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ if $disableImageOptimization }}
{{ with . }}
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ else }}
{{ with .Fill "600x600" }}
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ with .Fill "600x600" }}
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{- else -}}
{{- with $.Site.Params.images }}

View file

@ -12,8 +12,6 @@
{{ $articleImageClasses = delimit (slice $articleImageClasses "thumbnailshadow md:mr-7") " " }}
{{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ $articleInnerClasses := "" }}
{{ if .Site.Params.list.showCards }}
{{ $articleInnerClasses = delimit (slice $articleInnerClasses "p-4") " " }}
@ -34,15 +32,9 @@
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ if $disableImageOptimization }}
{{ with . }}
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ else }}
{{ with .Fill "600x400" }}
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ end }}
{{ with .Fill "600x400" }}
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{- else -}}
{{- with $.Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}}

View file

@ -1,5 +1,3 @@
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*background*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
@ -15,21 +13,12 @@
(and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) ($isParentList))
) }}
{{- with $featured -}}
{{ with .Resize "1200x" }}
{{ if $shouldAddHeaderSpace | default true}}
<div id="hero" class="h-[150px] md:h-[200px]"></div>
{{ end }}
{{ if $disableImageOptimization }}
{{ with . }}
<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="background-image:url({{ .RelPermalink }});">
{{ 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 }}
<div class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
</div>
<div
@ -46,4 +35,5 @@
});
</script>
{{ end }}
{{ end }}
{{- end -}}

View file

@ -1,16 +1,8 @@
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ if $disableImageOptimization }}
{{ 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 }}
{{ with .Resize "1200x" }}
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ with .Resize "1200x" }}
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{- end -}}

View file

@ -1,16 +1,8 @@
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ if $disableImageOptimization }}
{{ with . }}
{{ with .Resize "1200x" }}
<img class="w-full rounded-lg single_hero_round nozoom" src="{{ .RelPermalink }}">
{{ end }}
{{ else }}
{{ with .Resize "1200x" }}
<img class="w-full rounded-lg single_hero_round nozoom" src="{{ .RelPermalink }}">
{{ end }}
{{ end }}
{{- end -}}

View file

@ -1,5 +1,3 @@
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- $images := .Resources.ByType "image" -}}
{{- $background := $images.GetMatch "*background*" -}}
{{- if not $background }}{{ with .Site.Params.defaultBackgroundImage }}{{ $background = resources.Get . }}{{ end }}{{ end -}}
@ -16,30 +14,12 @@
) }}
{{- with $featured -}}
{{ if $disableImageOptimization }}
{{ with . }}
<div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ else }}
{{ with .Resize "1200x" }}
<div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ end }}
{{- end -}}
{{- with $background -}}
{{ if $disableImageOptimization }}
{{ with . }}
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
style="background-image:url({{ .RelPermalink }});">
<div class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
</div>
<div
class="absolute inset-0 opacity-30 dark:opacity-60 bg-gradient-to-t from-neutral dark:from-neutral-800 to-neutral dark:to-neutral-800 mix-blend-normal">
</div>
</div>{{ end }}
{{ else }}
{{ with .Resize "1200x" }}
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
style="background-image:url({{ .RelPermalink }});">
@ -48,9 +28,8 @@
<div
class="absolute inset-0 opacity-30 dark:opacity-60 bg-gradient-to-t from-neutral dark:from-neutral-800 to-neutral dark:to-neutral-800 mix-blend-normal">
</div>
</div>{{ end }}
</div>
{{ end }}
{{- end -}}
{{ if $shouldBlur | default false }}

View file

@ -2,8 +2,6 @@
<div
class="border border-neutral-200 dark:border-neutral-700 border-2 rounded overflow-hidden shadow-2xl relative backdrop-blur">
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- with site.Params.images -}}
{{- range first 6 . }}
<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
@ -12,15 +10,9 @@
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{ if $disableImageOptimization }}
{{ with . }}
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ else }}
{{ with .Fill "600x600" }}
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ end }}
{{ with .Fill "600x600" }}
<div class="w-full thumbnail_card_term nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{- else -}}
{{- with site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" />{{ end -}}