Using Where With Group By


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>
            {{ range .Pages }}
            {{ .Render "content-list" }}
            {{ end }}
        {{ end }}

Thanks in advance.


It’s your where statement:

try something like

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

Thanks pointyfar. That fixed my issue.