I feel like I’m missing something simple here, but after reading the doc page, multiple threads on here, and a couple of (great) blog posts, I’m still missing what I need to do.
The original code that worked:
{{ $notices := .Site.GetPage "/deprecation-notices" }}
{{ with $notices }}
{{ range .Pages.GroupByParam "effective" }}
<h3 class="h4">{{ dateFormat "January 2006" .Key }}</h3>
<ol>
{{ range .Pages.ByTitle }}
<li><a href="#{{ anchorize .Title }}">{{ .Title }}</a></li>
{{ end }}
</ol>
{{ end }}
{{ end }}
(This is in a private repo, sorry I can’t link directly to it). When this was accessed as a page bundle it worked fine, but the problem of course is that Hugo generates html files for all of the snippets I have in /content/deprecation-notices/. So I did some more research and discovered headless bundles! Problem solved! Except once I transition it to a headless bundle, the above code no longer works.
I’ve tried so many combinations it’s not worth putting them all here but needless to say once I use .Resources to get the pages I want from $notices, the .Pages.GroupByParam throws a “can’t evaluate field Pages” error. I’ve tried using group and sort but with no success.
Not sure how to fix the above code once I’ve moved from a page bundle to a headless bundle. Any advice or pointing in the right direction is greatly appreciated.