Hello!
I’ve a image partial as folows:
{{- $imagePath := printf "assets/%s" .name -}}
{{- $imageOriginal := .parent.Resources.GetMatch $imagePath -}}
{{- $imageNormalized := $imageOriginal.Resize "1200x" | resources.Copy (printf "%s%s" .parent.RelPermalink $imagePath) -}}
{{- $imageExtension := index (last 1 (split (index (last 1 (split $imageNormalized.RelPermalink "/")) 0) ".")) 0 -}}
<div
u-overflow="hidden"
{{ range .container }}
{{ printf "%s='%s'" .name .value | safeHTMLAttr }}
{{ end }}>
<img
lazy
alt="{{- $imageOriginal.Title -}}"
data-src="{{- $imageNormalized.RelPermalink -}}"
height="{{- $imageNormalized.Height -}}"
src="{{- ($imageOriginal.Resize "64x" | resources.Copy (printf "%s%s" .parent.RelPermalink (printf "assets/%s-low.%s" (strings.TrimSuffix (printf ".%s" $imageExtension) .name) $imageExtension))).RelPermalink -}}"
u-h="full"
u-object="contain"
u-transition="duration-500 ease filter"
u-w="full"
width="{{- $imageNormalized.Width -}}"/>
</div>
Basically, I’m generating an image with the max-width of 1200px scaled proportionally and a low-quality placeholder of width 64px. To have predictable names, I’m using resources.Copy
method. However, I seem to be getting a duplicate copy in the output then:
Here, flower-1.jpg
, flower-1-low.jpg
, flower-2.jpg
, flower-2-low.jpg
is expected. The others are not. While it’s not causing breaking issues anywhere in the website, I’d like to get rid of the duplicates if possible.
Am I doing something incorrectly causing the duplicates? Is there a way to disable those?