Revert "🐛 Fix: Reassignment of variable names"

This reverts commit 80486364cd.
This commit is contained in:
ZhenShuo Leo
2025-07-11 08:59:42 +08:00
parent 0999dc2319
commit 95b62176cf
4 changed files with 13 additions and 13 deletions
+5 -5
View File
@@ -74,14 +74,14 @@
{{ end }} {{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} {{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ range $backgroundAndFeaturedImages }} {{ range $backgroundAndFeaturedImages }}
{{ $classImages := slice }} {{ $images := slice }}
{{ if or $disableImageOptimization (strings.HasSuffix .Name ".svg") }} {{ if or $disableImageOptimization (strings.HasSuffix .Name ".svg") }}
{{ $classImages = $classImages | append . }} {{ $images = $images | append . }}
{{ else }} {{ else }}
{{ $classImages = $classImages | append (.Resize "600x") }} {{ $images = $images | append (.Resize "600x") }}
{{ $classImages = $classImages | append (.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x")) }} {{ $images = $images | append (.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x")) }}
{{ end }} {{ end }}
{{ range $classImages }} {{ range $images }}
{{ $className := printf "background-image-%s" (md5 .RelPermalink) }} {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
{{ $cssBackgroundImage := printf ".%s { background-image: url(\"%s\"); }" $className .RelPermalink }} {{ $cssBackgroundImage := printf ".%s { background-image: url(\"%s\"); }" $className .RelPermalink }}
{{ $cssBackgroundImage = $cssBackgroundImage | resources.FromString "css/background-image.css" }} {{ $cssBackgroundImage = $cssBackgroundImage | resources.FromString "css/background-image.css" }}
+1 -1
View File
@@ -1,7 +1,7 @@
{{ $images := .Resources.ByType "image" }} {{ $images := .Resources.ByType "image" }}
{{ $backgroundImage := $images.GetMatch "*background*" }} {{ $backgroundImage := $images.GetMatch "*background*" }}
{{ if not $backgroundImage }} {{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "*feature*" }} {{ $backgroundImage := $images.GetMatch "*feature*" }}
{{ end }} {{ end }}
{{ if not $backgroundImage }} {{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }} {{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
+1 -1
View File
@@ -1,7 +1,7 @@
{{ $images := .Resources.ByType "image" }} {{ $images := .Resources.ByType "image" }}
{{ $backgroundImage := $images.GetMatch "*background*" }} {{ $backgroundImage := $images.GetMatch "*background*" }}
{{ if not $backgroundImage }} {{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "*feature*" }} {{ $backgroundImage := $images.GetMatch "*feature*" }}
{{ end }} {{ end }}
{{ if not $backgroundImage }} {{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }} {{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
@@ -13,7 +13,7 @@
{{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }} {{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
{{ end }} {{ end }}
{{ if not $backgroundImage }} {{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "*feature*" }} {{ $backgroundImage := $images.GetMatch "*feature*" }}
{{ end }} {{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} {{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ if and ($backgroundImage) (not (or ($disableImageOptimization) (strings.HasSuffix $backgroundImage.Name ".svg"))) }} {{ if and ($backgroundImage) (not (or ($disableImageOptimization) (strings.HasSuffix $backgroundImage.Name ".svg"))) }}
@@ -31,7 +31,7 @@
{{ $featuredImage = resources.Get .Site.Params.defaultFeaturedImage }} {{ $featuredImage = resources.Get .Site.Params.defaultFeaturedImage }}
{{ end }} {{ end }}
{{ if not $featuredImage }} {{ if not $featuredImage }}
{{ $featuredImage = $images.GetMatch "*background*" }} {{ $featuredImage := $images.GetMatch "*background*" }}
{{ end }} {{ end }}
{{ if not $featuredImage }} {{ if not $featuredImage }}
{{ with .Site.Params.defaultFeaturedImage }} {{ with .Site.Params.defaultFeaturedImage }}
@@ -53,13 +53,13 @@
) }} ) }}
{{ with $featuredImage }} {{ with $featuredImage }}
{{ $classNameFeaturedImage := printf "background-image-%s" (md5 .RelPermalink) }} {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
<div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom {{ $classNameFeaturedImage }}"></div> <div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom {{ $className }}"></div>
{{ end }} {{ end }}
{{ with $backgroundImage }} {{ with $backgroundImage }}
{{ $classNameBackgroundImage := printf "background-image-%s" (md5 .RelPermalink) }} {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom {{ $classNameBackgroundImage }}"> <div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom {{ $className }}">
<div <div
class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"> class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
</div> </div>