How to add gif to my Hugo website?

In my markdown file:

![my gif](/images/2023-12-14_111611.gif)

When I am trying to run Hugo, the following error comes out:

execute of template failed: template: _default/_markup/render-image.html:172:12: executing “_default/_markup/render-image.html” at <$r.Height>: can’t evaluate field Height in type string

I checked the render-image.html. Looks like it cannot deal with gif file correctly.

How can I exclude gif files from being handled by the image filter?

The error indicates that the $r is a string other than an image resource, you may need to check the code, couldn’t provide further help without seeing your code.

Can you post the content of render-image.html ?

{{ if ne $original.MediaType.SubType "gif" }}
  "code for non gif images"
{{ end }}
1 Like