diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 6b7aa75d..a1db6860 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -54,48 +54,6 @@
{{ $cssZoom := resources.Get "lib/zoom/style.css" }}
{{ $assets.Add "css" (slice $cssZoom) }}
{{ end }}
-
- {{ $images := slice }}
- {{ $backgroundAndfeaturedImages := slice }}
- {{ range .Site.Pages }}
- {{ $images = $images | append (.Page.Resources.ByType "image") }}
- {{ if .Params.featureimage }}
- {{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append (resources.GetRemote .Params.featureimage) }}
- {{ end }}
- {{ end }}
- {{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append ($images.Match "{*background*,*feature*,*cover*,*thumbnail*}") }}
- {{ $siteParams := slice .Site.Params.defaultFeaturedImage .Site.Params.defaultBackgroundImage }}
- {{ range $siteParams }}
- {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
- {{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append (resources.GetRemote .) }}
- {{ else }}
- {{ $backgroundAndfeaturedImages = $backgroundAndfeaturedImages | append (resources.Get .) }}
- {{ end }}
- {{ end }}
- {{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
- {{ range $backgroundAndfeaturedImages }}
- {{ $backgroundAndfeaturedImages := . }}
- {{ if not (or ($disableImageOptimization) (strings.HasSuffix .Name ".svg")) }}
- {{ $backgroundAndfeaturedImages = .Resize "600x" }}
- {{ end }}
- {{ with $backgroundAndfeaturedImages }}
- {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
- {{ $cssBackgroundImage := printf ".%s { background-image: url(\"%s\"); }" $className .RelPermalink }}
- {{ $cssBackgroundImage = $cssBackgroundImage | resources.FromString "css/background-image.css" }}
- {{ $assets.Add "css" (slice $cssBackgroundImage) }}
- {{ end }}
- {{ end }}
-
- {{ $repoLanguages := partial "functions/repo-languages.html" }}
- {{ $repoColors := .Site.Data.repoColors }}
- {{ range $repoLanguages }}
- {{ $color := index $repoColors . | default "#0077b6" }}
- {{ $className := printf "background-color-%s" (md5 .) }}
- {{ $cssRepoColor := printf ".%s { background-color: %s; }" $className $color }}
- {{ $cssRepoColor = $cssRepoColor | resources.FromString (printf "css/background-color.css") }}
- {{ $assets.Add "css" (slice $cssRepoColor) }}
- {{ end }}
-
{{ $bundleCSS := $assets.Get "css" | resources.Concat "css/main.bundle.css" | resources.Minify | resources.Fingerprint
(.Site.Params.fingerprintAlgorithm | default "sha512")
}}
diff --git a/layouts/partials/hero/background.html b/layouts/partials/hero/background.html
index 674df3c8..c3adf2e0 100644
--- a/layouts/partials/hero/background.html
+++ b/layouts/partials/hero/background.html
@@ -1,55 +1,62 @@
-{{ $images := .Resources.ByType "image" }}
-{{ $backgroundImage := $images.GetMatch "*background*" }}
-{{ if not $backgroundImage }}
- {{ $backgroundImage := $images.GetMatch "*feature*" }}
-{{ end }}
-{{ if not $backgroundImage }}
- {{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
-{{ end }}
-{{ if and (not $backgroundImage) .Params.featureimage }}
- {{ $backgroundImage = resources.GetRemote .Params.featureimage }}
-{{ end }}
-{{ if not $backgroundImage }}
- {{ with .Site.Params.defaultBackgroundImage }}
- {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
- {{ $backgroundImage = resources.GetRemote . }}
- {{ else }}
- {{ $backgroundImage = resources.Get . }}
- {{ end }}
- {{ end }}
-{{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
-{{ if and ($backgroundImage) (not (or ($disableImageOptimization) (strings.HasSuffix $backgroundImage.Name ".svg"))) }}
- {{ $backgroundImage = $backgroundImage.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
+
+{{- $images := .Resources.ByType "image" -}}
+{{- $featured := $images.GetMatch "*background*" -}}
+{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
+{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
+
+{{ if and .Params.featureimage (not $featured) }}
+{{- $url:= .Params.featureimage -}}
+{{ $featured = resources.GetRemote $url }}
{{ end }}
+{{- if not $featured }}
+ {{ with .Site.Params.defaultBackgroundImage }}
+ {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
+ {{ $featured = resources.GetRemote . }}
+ {{ else }}
+ {{ $featured = resources.Get . }}
+ {{ end }}
+ {{ end }}
+{{ end -}}
+
{{ $isParentList := eq (.Scratch.Get "scope") "list" }}
-{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or
- (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList))
+{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or
+ (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList))
(and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList))
) }}
-{{ $shouldAddHeaderSpace := $.Params.layoutBackgroundHeaderSpace | default (or
- (and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (not $isParentList))
+{{ $shouldAddHeaderSpace := $.Params.layoutBackgroundHeaderSpace | default (or
+ (and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (not $isParentList))
(and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) ($isParentList))
) }}
+{{- with $featured -}}
-{{ with $backgroundImage }}
- {{ if $shouldAddHeaderSpace | default true}}
-
- {{ end }}
- {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
-
- {{ if $shouldBlur | default false }}
-
- {{ $backgroundBlur := resources.Get "js/background-blur.js" }}
- {{ $backgroundBlur = $backgroundBlur | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
-
- {{ end }}
+{{ if $shouldAddHeaderSpace | default true}}
+
{{ end }}
+
+{{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg")}}
+ {{ with . }}
+
+ {{ end }}
+{{ else }}
+ {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
+
+ {{ end }}
+{{ end }}
+
+
+
+
+
+
+{{ if $shouldBlur | default false }}
+
+{{ $backgroundBlur := resources.Get "js/background-blur.js" }}
+{{ $backgroundBlur = $backgroundBlur | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
+
+{{ end }}
+{{- end -}}
diff --git a/layouts/partials/hero/basic.html b/layouts/partials/hero/basic.html
index de8e0882..54e84ed3 100644
--- a/layouts/partials/hero/basic.html
+++ b/layouts/partials/hero/basic.html
@@ -1,29 +1,37 @@
-{{ $images := .Resources.ByType "image" }}
-{{ $backgroundImage := $images.GetMatch "*background*" }}
-{{ if not $backgroundImage }}
- {{ $backgroundImage := $images.GetMatch "*feature*" }}
-{{ end }}
-{{ if not $backgroundImage }}
- {{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
-{{ end }}
-{{ if and (not $backgroundImage) .Params.featureimage }}
- {{ $backgroundImage = resources.GetRemote .Params.featureimage }}
-{{ end }}
-{{ if not $backgroundImage }}
- {{ with .Site.Params.defaultBackgroundImage }}
- {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
- {{ $backgroundImage = resources.GetRemote . }}
- {{ else }}
- {{ $backgroundImage = resources.Get . }}
- {{ end }}
- {{ end }}
-{{ end }}
{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
-{{ if and ($backgroundImage) (not (or ($disableImageOptimization) (strings.HasSuffix $backgroundImage.Name ".svg"))) }}
- {{ $backgroundImage = $backgroundImage.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
+
+{{- $images := .Resources.ByType "image" -}}
+{{- $featured := $images.GetMatch "*background*" -}}
+{{- if not $featured }}{{ $featured = $images.GetMatch "*feature*" }}{{ end -}}
+{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
+
+{{ if and .Params.featureimage (not $featured) }}
+ {{- $url:= .Params.featureimage -}}
+ {{ $featured = resources.GetRemote $url }}
{{ end }}
-{{ with $backgroundImage }}
- {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
-
-{{ end }}
+{{- if not $featured }}
+ {{ with .Site.Params.defaultBackgroundImage }}
+ {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
+ {{ $featured = resources.GetRemote . }}
+ {{ else }}
+ {{ $featured = resources.Get . }}
+ {{ end }}
+ {{ end }}
+{{ end -}}
+
+{{- with $featured -}}
+ {{ if or $disableImageOptimization (strings.HasSuffix $featured ".svg") }}
+ {{ with . }}
+
+ {{ end }}
+ {{ else }}
+ {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
+
+ {{ end }}
+ {{ end }}
+{{- end -}}
diff --git a/layouts/partials/hero/thumbAndBackground.html b/layouts/partials/hero/thumbAndBackground.html
index 841f83ec..2a8448cb 100644
--- a/layouts/partials/hero/thumbAndBackground.html
+++ b/layouts/partials/hero/thumbAndBackground.html
@@ -1,77 +1,98 @@
-{{ $images := .Resources.ByType "image" }}
-{{ $backgroundImage := $images.GetMatch "*background*" }}
-{{ if not $backgroundImage }}
+{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
+
+{{- $images := .Resources.ByType "image" -}}
+{{- $background := $images.GetMatch "*background*" -}}
+
+{{- if not $background }}
{{ with .Site.Params.defaultBackgroundImage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
- {{ $backgroundImage = resources.GetRemote . }}
+ {{ $background = resources.GetRemote . }}
{{ else }}
- {{ $backgroundImage = resources.Get . }}
+ {{ $background = resources.Get . }}
{{ end }}
{{ end }}
-{{ end }}
-{{ if not $backgroundImage }}
- {{ $backgroundImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
-{{ end }}
-{{ if not $backgroundImage }}
- {{ $backgroundImage := $images.GetMatch "*feature*" }}
-{{ end }}
-{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
-{{ if and ($backgroundImage) (not (or ($disableImageOptimization) (strings.HasSuffix $backgroundImage.Name ".svg"))) }}
- {{ $backgroundImage = $backgroundImage.Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
-{{ end }}
+{{ end -}}
-{{ $featuredImage := $images.GetMatch "*feature*" }}
-{{ if not $featuredImage }}
- {{ $featuredImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
+{{- if not $background }}{{ $background = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
+{{- if not $background }}{{ $background = $images.GetMatch "*feature*" }}{{ end -}}
+{{- $featured := $images.GetMatch "*feature*" -}}
+{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
+{{ if .Params.featureimage }}
+ {{- $url:= .Params.featureimage -}}
+ {{- if not $featured }}{{ $featured = resources.GetRemote $url }}{{ end -}}
{{ end }}
-{{ if and (not $featuredImage) .Params.featureimage }}
- {{ $featuredImage = resources.GetRemote .Params.featureimage }}
-{{ end }}
-{{ if not $featuredImage }}
- {{ $featuredImage = resources.Get .Site.Params.defaultFeaturedImage }}
-{{ end }}
-{{ if not $featuredImage }}
- {{ $featuredImage := $images.GetMatch "*background*" }}
-{{ end }}
-{{ if not $featuredImage }}
+{{- if not $featured }}{{ $featured = $images.GetMatch "*background*" }}{{ end -}}
+
+{{- if not $featured }}
{{ with .Site.Params.defaultFeaturedImage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
- {{ $featuredImage = resources.GetRemote . }}
+ {{ $featured = resources.GetRemote . }}
{{ else }}
- {{ $featuredImage = resources.Get . }}
+ {{ $featured = resources.Get . }}
{{ end }}
{{ end }}
-{{ end }}
-{{ if and ($featuredImage) (not (or ($disableImageOptimization) (strings.HasSuffix $featuredImage.Name ".svg"))) }}
- {{ $featuredImage = $featuredImage.Resize "600x" }}
-{{ end }}
+{{ end -}}
-{{ $isParentList := eq (.Scratch.Get "scope") "list" }}
+{{ $isParentList := eq (.Scratch.Get "scope") "list" }}
{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or
- (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList))
- (and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList))
- ) }}
+ (and ($.Site.Params.article.layoutBackgroundBlur | default true) (not $isParentList))
+ (and ($.Site.Params.list.layoutBackgroundBlur | default true) ($isParentList))
+ )
+}}
-{{ with $featuredImage }}
- {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
-
-{{ end }}
+{{- with $featured -}}
+ {{ if or $disableImageOptimization (strings.HasSuffix . ".svg") }}
+ {{ with . }}
+
+ {{ end }}
+ {{ else }}
+ {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
+
+ {{ end }}
+ {{ end }}
+{{- end -}}
-{{ with $backgroundImage }}
- {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
-
-{{ end }}
+{{- with $background -}}
+
+ {{ if or $disableImageOptimization (strings.HasSuffix . ".svg") }}
+ {{ with . }}
+
+ {{ end }}
+ {{ else }}
+ {{ with .Resize (print ($.Site.Params.backgroundImageWidth | default "1200") "x") }}
+
+ {{ end }}
+ {{ end }}
+
+{{- end -}}
{{ if $shouldBlur | default false }}
-
+
{{ $backgroundBlur := resources.Get "js/background-blur.js" }}
- {{ $backgroundBlur = $backgroundBlur | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
-
+ {{ $backgroundBlur = $backgroundBlur | resources.Minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
+
{{ end }}
diff --git a/layouts/partials/term-link/card.html b/layouts/partials/term-link/card.html
index 31fdc225..280a74d4 100644
--- a/layouts/partials/term-link/card.html
+++ b/layouts/partials/term-link/card.html
@@ -1,29 +1,32 @@
+ {{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
+
{{- with site.Params.images -}}
{{- range first 6 . }}
{{ end -}}
{{- else -}}
- {{ $images := .Page.Resources.ByType "image" }}
- {{ $featuredImage := $images.GetMatch "*feature*" }}
- {{ if not $featuredImage }}
- {{ $featuredImage = $images.GetMatch "{*cover*,*thumbnail*}" }}
- {{ end }}
- {{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
- {{ if and ($featuredImage) (not (or ($disableImageOptimization) (strings.HasSuffix $featuredImage.Name ".svg"))) }}
- {{ $featuredImage = $featuredImage.Resize "600x" }}
- {{ end }}
- {{ with $featuredImage }}
- {{ $className := printf "background-image-%s" (md5 .RelPermalink) }}
-
- {{ else }}
- {{ with site.Params.images }}
-
+ {{- $images := .Page.Resources.ByType "image" -}}
+ {{- $featured := $images.GetMatch "*feature*" -}}
+ {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
+ {{- with $featured -}}
+ {{ if $disableImageOptimization }}
+ {{ with . }}
+
+ {{ end }}
+ {{ else }}
+ {{ with .Resize "600x" }}
+
+ {{ end }}
{{ end }}
- {{ end }}
- {{ end }}
+ {{- else -}}
+ {{- with site.Params.images }}
+
+ {{ end -}}
+ {{- end -}}
+ {{- end -}}
{{ if site.Params.taxonomy.showTermCount | default true }}