Hi all,
I’m not sure how to do this so wanted to ask here. How can I limit the number of posts for a taxonomy term?
I am using the latest version of HUGO.
My code snippet:
{{ range .Site.Taxonomies.foo.bar }}
{{ partial "baz" . }}
{{ end }}
I tried {{ range first 5 (where .Site.Taxonomies.foo.bar) }} but then gave me an error saying it expected two but only got one.
I haven’t verified but try using parentheses to make it clear as to which arguments go to range and which go to first: {{ range (first 5 (where site.Taxonomies.foo.bar)) }}
Update Sorry for the bad advice above; @jmooring has fixed that.
Also, it’s more canonical to use site. instead of .Site.. That way you never end with with an issue of attempting to get the Site object from a wrong scope.