Browse Source

img instead of image for variable shadowing

Alexander Avery 3 weeks ago
parent
commit
6b326600c6
  1. 6
      layouts/partials/image.html

6
layouts/partials/image.html

@ -7,7 +7,7 @@ Renders an image with the given class, alt, and sizes.
*/}}
{{- $alt := .alt }}
{{- $image := .image }}
{{- $img := .image }}
{{- $sizes := .sizes }}
{{- $classes := .classes }}
@ -18,7 +18,7 @@ Renders an image with the given class, alt, and sizes.
{{/* Loop through widths to resize images and build attributes */}}
{{- range $index, $width := $sizes }}
{{- $resizeSpec := printf "%dx webp q90" $width }}
{{- $resized := ($image.Resize $resizeSpec) }}
{{- $resized := ($img.Resize $resizeSpec) }}
{{- $srcsetParts = $srcsetParts | append (printf "%s %dw" $resized.RelPermalink $width) }}
@ -33,7 +33,7 @@ Renders an image with the given class, alt, and sizes.
{{- $smallestWidth := index $sizes 0 }}
{{- $smallestResizeSpec := printf "%dx webp q90" $smallestWidth }}
{{- $smallest := ($image.Resize $smallestResizeSpec) }}
{{- $smallest := ($img.Resize $smallestResizeSpec) }}
{{- $src := $smallest.RelPermalink }}
<img class="{{ delimit $classes " " }}"
src="{{ $src }}"

Loading…
Cancel
Save