diff options
Diffstat (limited to 'themes/default/layouts/partials/function-caches-images.html')
-rw-r--r-- | themes/default/layouts/partials/function-caches-images.html | 24 |
1 files changed, 12 insertions, 12 deletions
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 |