From d47d872c04e73ae7a7c3cc763319026e3a3e954b Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 3 Sep 2022 19:41:26 -0400 Subject: themes/default/layouts/partials/function-caches-images: Namespace alternate copy Make the name distinct, it might eventually be a slice. --- themes/default/layouts/_default/rss.xml | 2 +- themes/default/layouts/partials/author-card.html | 2 +- themes/default/layouts/partials/author-header.html | 2 +- .../default/layouts/partials/author-picture.html | 2 +- .../layouts/partials/function-caches-images.html | 24 +++++++++++----------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index 2a85b8f..0173524 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -20,7 +20,7 @@ "Fit" "160x160" "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") "Copy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.Base $profile)) - "OptimizedCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $profile) ".webp") + "AlternateCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $profile) ".webp") ) -}} diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 557abdd..7f8a5d6 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -11,7 +11,7 @@ "Fit" "160x160" "Target" (print (partial "function-paths.html" "media") "/" .Data.user "/") "Copy" (print (partial "function-paths.html" "media") "/" .Data.user "/" (path.Base $profile)) - "OptimizedCopy" (print (partial "function-paths.html" "media") "/" .Data.user "/" (path.BaseName $profile) ".webp") + "AlternateCopy" (print (partial "function-paths.html" "media") "/" .Data.user "/" (path.BaseName $profile) ".webp") ) -}} diff --git a/themes/default/layouts/partials/author-header.html b/themes/default/layouts/partials/author-header.html index ddb4724..b1b1634 100644 --- a/themes/default/layouts/partials/author-header.html +++ b/themes/default/layouts/partials/author-header.html @@ -12,7 +12,7 @@ "Resize" "x600" "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") "Copy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.Base $header)) - "OptimizedCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $header) ".webp") + "AlternateCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $header) ".webp") ) -}} diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index ad878bf..d5d87f4 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -12,7 +12,7 @@ "Fit" "160x160" "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") "Copy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.Base $profile)) - "OptimizedCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $profile) ".webp") + "AlternateCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $profile) ".webp") ) -}} diff --git a/themes/default/layouts/partials/function-caches-images.html b/themes/default/layouts/partials/function-caches-images.html index df5c17f..64e72a1 100644 --- a/themes/default/layouts/partials/function-caches-images.html +++ b/themes/default/layouts/partials/function-caches-images.html @@ -7,10 +7,10 @@ {{- $directory := path.Dir $copy -}} {{- $basename := path.BaseName $copy -}} {{- $type := strings.TrimPrefix "." (path.Ext $copy) -}} -{{- $optimized := or .OptimizedCopy (print $directory "/" $basename ".webp") -}} -{{- $optimizedType := strings.TrimPrefix "." (path.Ext $optimized) -}} +{{- $alternateCopy := or .AlternateCopy (print $directory "/" $basename ".webp") -}} +{{- $alternateType := strings.TrimPrefix "." (path.Ext $alternateCopy) -}} {{- $isFile := ne (path.Base $copy) "." -}} -{{- $cached := and $isFile (fileExists (print "public/" $copy)) (fileExists (print "public/" $optimized)) -}} +{{- $cached := and $isFile (fileExists (print "public/" $copy)) (fileExists (print "public/" $alternateCopy)) -}} {{- $local := print "public/" $source -}} {{- $localized := fileExists $local -}} @@ -41,9 +41,9 @@ ) -}} {{- $image = .Content | resources.FromString (print $target (path.Base .)) -}} - {{- with $fit -}} {{- $image = $image.Fit (print $fit " " $optimizedType) -}} {{- end -}} - {{- with $resize -}} {{- $image = $image.Resize (print $resize " " $optimizedType) -}} {{- end -}} - {{- $image = $image | resources.Copy $optimized -}} + {{- with $fit -}} {{- $image = $image.Fit (print $fit " " $alternateType) -}} {{- end -}} + {{- with $resize -}} {{- $image = $image.Resize (print $resize " " $alternateType) -}} {{- end -}} + {{- $image = $image | resources.Copy $alternateCopy -}} {{- $data = merge $data (dict "OptPermalink" $image.Permalink @@ -72,9 +72,9 @@ ) -}} {{- $image = .Content | resources.FromString (print $target (path.Base .)) -}} - {{- with $fit -}} {{- $image = $image.Fit (print $fit " " $optimizedType) -}} {{- end -}} - {{- with $resize -}} {{- $image = $image.Resize (print $resize " " $optimizedType) -}} {{- end -}} - {{- $image = $image | resources.Copy $optimized -}} + {{- with $fit -}} {{- $image = $image.Fit (print $fit " " $alternateType) -}} {{- end -}} + {{- with $resize -}} {{- $image = $image.Resize (print $resize " " $alternateType) -}} {{- end -}} + {{- $image = $image | resources.Copy $alternateCopy -}} {{- $data = merge $data (dict "OptPermalink" $image.Permalink @@ -97,9 +97,9 @@ ) -}} {{- $image = .Content | resources.FromString (print $target (path.Base .)) -}} - {{- with $fit -}} {{- $image = $image.Fit (print $fit " " $optimizedType) -}} {{- end -}} - {{- with $resize -}} {{- $image = $image.Resize (print $resize " " $optimizedType) -}} {{- end -}} - {{- $image = $image | resources.Copy $optimized -}} + {{- with $fit -}} {{- $image = $image.Fit (print $fit " " $alternateType) -}} {{- end -}} + {{- with $resize -}} {{- $image = $image.Resize (print $resize " " $alternateType) -}} {{- end -}} + {{- $image = $image | resources.Copy $alternateCopy -}} {{- $data = merge $data (dict "OptPermalink" $image.Permalink -- cgit v1.2.3