Hi,
I’ve been starting to use @sod 's wonderful bookmarks shortcode plug-in to show my saved bookmarks on my blog based on this thread.
After having success in organising my standard blog post archive list to group by month rather than 1 big long list I wanted to do the same with my bookmarks.
I did the archive page successfully with code like this:
{{ $list := (where .Site.Pages "Type" "post") }}
{{ range $list.GroupByDate "January 2006" }}
{{ range .Pages }}
// code for what I want to display
{{ end }}
{{ end }}
wanted to say thankyou to @jsonbecker whose posts like this one helped me greatly with that!
But I couldn’t yet get it working with bookmarks. My assumption is that bookmarks don’t have a “date” as such so I need to tell it what to group by.
I had hoped that code something like this would work:
{{< bookmarks >}}
{{ range .items.GroupByParamDate "date_published" "January 2006" }}
{{ range .items }}
// whatever I want to display
{{ end }}
{{ end }}
But it doesn’t. I get this error:
EXECUTE-AS-TEMPLATE: failed to transform “bookmarks-shortcode-template.html” (text/html): template: bookmarks-shortcode-template.html:6:15: executing “bookmarks-shortcode-template.html” at <.items.GroupByParamDate>: can’t evaluate field GroupByParamDate in type interface {}
maybe date_published isn’t considered a parameter or I need to groupby something other than .items.
I know .date_published exists bc I can do things like this successfully:
{ time.Format "2 Jan 2006" (time.AsTime .date_published)
Does anyone know if I’m on the right tracks or am I attempting the impossible?
Thanks as always!