Hi, I’ve been trying to put GIF images on my website, but it keeps converting them into WebP static images. How can I exclude GIFs from this conversion? I have read the docs and nothing seems to solve this problem. Using Hugo Hinode.
<!-- Generate a image set of type webp -->
{{- define "partials/image-scaled.html " -}}
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{- $img := .img -}}
{{- $ratio := .ratio -}}
{{- $portrait := and .portrait .ratio -}}
{{- $imgset := "" -}}
{{- $widths := slice "576" "768" "992" "1200" "1400" -}}
{{- $dims := slice -}}
{{- with $img -}}
{{- if eq $ratio "4x3" -}}
{{- $dims = slice "576x432" "768x576" "992x744" "1200x900" "1400x1050" -}}
{{- else if eq $ratio "3x2" -}}
{{- $dims = slice "576x384" "768x512" "992x661" "1200x800" "1400x933" -}}
{{- else if eq $ratio "1x1" -}}
{{- $dims = slice "576x576" "768x768" "992x992" "1200x1200" "1400x1400" -}}
{{- else if eq $ratio "16x9" -}}
{{- $dims = slice "576x324" "768x432" "992x558" "1200x675" "1400x788" -}}
{{- else if eq $ratio "21x9" -}}
{{- $dims = slice "576x247" "768x329" "992x425" "1200x514" "1400x600" -}}
{{- else -}}
{{- range $width := $widths -}}
{{- $dims = $dims | append (printf "%sx%d" $width (int (math.Round (mul (div (float $width) $img.Width) $img.Height)))) -}}
{{- end -}}
{{- end -}}
{{- if $portrait -}}
{{- $dims = partial "partials/image-portrait.html" (dict "dim" $dims) -}}
{{- end -}}
{{- $scaled := "" -}}
{{- range $index, $dim := $dims -}}
{{- $clean := path.Ext $img.RelPermalink -}}
{{- if $ratio -}}
{{- $scaled = $img.Fill (printf "%s webp" $dim) -}}
{{- else -}}
{{- $scaled = $img.Fit (printf "%s webp" $dim) -}}
{{- end -}}
{{- $scaled = $scaled | resources.Copy (replace $img.RelPermalink $clean (printf "-%s.webp" $dim)) -}}
{{- if $absoluteURL -}}
{{- $imgset = printf "%s, %s %sw" $imgset $scaled.Permalink (index $widths $index) -}}
{{- else -}}
{{- $imgset = printf "%s, %s %sw" $imgset $scaled.RelPermalink (index $widths $index) -}}
{{- end -}}
{{- end -}}
{{- $imgset = strings.TrimPrefix ", " $imgset -}}
{{- end -}}
{{- return $imgset -}}
{{- end -}}
(Part from “image.html” that converts the images into WebP)