When I try to group a slice of pages by field “Params.paige.pin”, I get an error that doesn’t make sense to me. It seems to be complaining that the element type of page.Pages is Page.
Code:
{{ warnf "%v matches={%v} matchesty=%T field=%v fieldty=%T" time.Now.UnixNano (debug.Dump $matches) $matches $field $field}}
{{ $matchgroups := $matches.GroupBy $field }}
Output:
WARN 1717907409157755000 matches={[
{
"Date": "2023-10-03T18:12:15-07:00",
"Lastmod": "2023-10-03T18:12:15-07:00",
"PublishDate": "0001-01-01T00:00:00Z",
"ExpiryDate": "0001-01-01T00:00:00Z",
"Aliases": null,
"BundleType": "branch",
"Description": "",
"Draft": false,
"IsHome": false,
"Keywords": null,
"Kind": "taxonomy",
"Layout": "paige/cloud",
"LinkTitle": "Categories",
"IsNode": true,
"IsPage": false,
"Path": "/categories",
"Slug": "",
"Lang": "en",
"IsSection": false,
"Section": "categories",
"Sitemap": {
"ChangeFreq": "",
"Priority": -1,
"Filename": "sitemap.xml",
"Disable": false
},
"Type": "categories",
"Weight": 10
}
]} matchesty=page.Pages field=Params.paige.pin fieldty=string
ERROR Rebuild failed:
render:
failed to render pages:
render of "home" failed: "/Users/will/Developer/paige/layouts/_default/list.html:5:3":
execute of template failed at <partial "paige/pages.html" $page>:
error calling partial:
execute of template failed at <partial "paige/group.html" (dict "groups" (slice (dict "field" "Params.paige.pin" "operator" "eq" "value" true)) "pages" $collections)>: "/Users/will/Developer/paige/layouts/partials/paige/group.html:27:31":
execute of template failed at <$matches.GroupBy>:
error calling GroupBy:
reflect:
Elem of invalid type page.Page