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

View File

@@ -74,14 +74,14 @@
{{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ range $backgroundAndFeaturedImages }}
{{ $classImages := slice }}
{{ $images := slice }}
{{ if or $disableImageOptimization (strings.HasSuffix .Name ".svg") }}
{{ $classImages = $classImages | append . }}
{{ $images = $images | append . }}
{{ else }}
{{ $classImages = $classImages | append (.Resize "600x") }}
{{ $classImages = $classImages | append (.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x")) }}
{{ $images = $images | append (.Resize "600x") }}
{{ $images = $images | append (.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x")) }}
{{ end }}
{{ range $classImages }}
{{ range $images }}
{{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
{{ $cssBackgroundImage := printf ".%s { background-image: url(\"%s\"); }" $className .RelPermalink }}
{{ $cssBackgroundImage = $cssBackgroundImage | resources.FromString "css/background-image.css" }}

View File

@@ -1,7 +1,7 @@
{{ $images := .Resources.ByType "image" }}
{{ $backgroundImage := $images.GetMatch "*background*" }}
{{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "*feature*" }}
{{ $backgroundImage := $images.GetMatch "*feature*" }}
{{ end }}
{{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}

View File

@@ -1,7 +1,7 @@
{{ $images := .Resources.ByType "image" }}
{{ $backgroundImage := $images.GetMatch "*background*" }}
{{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "*feature*" }}
{{ $backgroundImage := $images.GetMatch "*feature*" }}
{{ end }}
{{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}

View File

@@ -13,7 +13,7 @@
{{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
{{ end }}
{{ if not $backgroundImage }}
{{ $backgroundImage = $images.GetMatch "*feature*" }}
{{ $backgroundImage := $images.GetMatch "*feature*" }}
{{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ if and ($backgroundImage) (not (or ($disableImageOptimization) (strings.HasSuffix $backgroundImage.Name ".svg"))) }}
@@ -31,7 +31,7 @@
{{ $featuredImage = resources.Get .Site.Params.defaultFeaturedImage }}
{{ end }}
{{ if not $featuredImage }}
{{ $featuredImage = $images.GetMatch "*background*" }}
{{ $featuredImage := $images.GetMatch "*background*" }}
{{ end }}
{{ if not $featuredImage }}
{{ with .Site.Params.defaultFeaturedImage }}
@@ -53,13 +53,13 @@
) }}
{{ with $featuredImage }}
{{ $classNameFeaturedImage := 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>
{{ $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 {{ $className }}"></div>
{{ end }}
{{ with $backgroundImage }}
{{ $classNameBackgroundImage := printf "background-image-%s" (md5 .RelPermalink) }}
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom {{ $classNameBackgroundImage }}">
{{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom {{ $className }}">
<div
class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">
</div>