diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 01a2865a..78ddbc3c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -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" }} diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html index 7faae0d9..674df3c8 100644 --- a/layouts/partials/hero/background.html +++ b/layouts/partials/hero/background.html @@ -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*}" }} diff --git a/layouts/partials/hero/basic.html b/layouts/partials/hero/basic.html index 2123652c..de8e0882 100644 --- a/layouts/partials/hero/basic.html +++ b/layouts/partials/hero/basic.html @@ -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*}" }} diff --git a/layouts/partials/hero/thumbAndBackground.html b/layouts/partials/hero/thumbAndBackground.html index ca83ff88..841f83ec 100644 --- a/layouts/partials/hero/thumbAndBackground.html +++ b/layouts/partials/hero/thumbAndBackground.html @@ -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) }} -
+ {{ $className := printf "background-image-%s" (md5 .RelPermalink) }} +
{{ end }} {{ with $backgroundImage }} - {{ $classNameBackgroundImage := printf "background-image-%s" (md5 .RelPermalink) }} -
+ {{ $className := printf "background-image-%s" (md5 .RelPermalink) }} +