Remove an image from a ressource range

Heya,

I use this code to show all the images in the same folder as my page. But this folder also contains a thumb.jpg image, that I don’t want to include in this range.

{{ range .Resources.ByType "image" }}
   <img src="{{ .Permalink }}">
{{ end }}

I checked https://gohugo.io/content-management/page-resources/ and the glog exemples. But I didn’t found anything that works.

Maybe by using a where clause.

1 Like

As Rick mentioned, try something like:

{{ $images := .Resources.ByType "image" }}
{{ $images := where $images "Name" "ne" "thumb.jpg" }}
{{ range $images }}
...
2 Likes

Ah thanks a lot, both of you! Works perfectly.