I have images of different sizes in my page resources. In a partial, I want only process those that do not contain the string “px” in their name. This
{{$images := .Page.Resources.ByType "image" }}
{{- range where $images "Name" "<>" "px" }}
still returns all images. The files are not part of the index.md's front matter.
Is there a way to achieve this?
{{ range .Page.Resources.ByType "image" }}
{{ if not (in .Name "px" ) }}
{{ .Name }}<br>
{{ end }}
{{ end }}
1 Like
Thanks a lot, that did it. Any idea why where would not do what I want?
See https://gohugo.io/functions/where/:
!=, <>, ne
true if a given field value doesn’t equal a matching value
Thanks again. I misread that, obviously.
1 Like
system
Closed
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.