Remove an image from a ressource range


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 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 }}

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