Using Where With Group By

Hi,

Is it possible to use where with a PageGroup? I’m trying to use GroupByParam to get a list of categories and then filter from there, but I keep getting “can’t give argument to non-function categorize”

   {{ $pages := .Paginate (where .Pages "Type" "post") }}
        {{ $categorized := $pages.Pages.GroupByParam "category" }}
        {{ range $categorized where .Key "Hugo" }}
        <h2>{{ .Key }}</h2>
        <ul>
            {{ range .Pages }}
            {{ .Render "content-list" }}
            {{ end }}
        </ul>
        {{ end }}

Thanks in advance.

Hi,

It’s your where statement: https://gohugo.io/functions/where/

try something like

{{ range where $categorized "Key" "Hugo" }}

Thanks pointyfar. That fixed my issue.