Tag posts grouped by year #2637
Replies: 2 comments 1 reply
-
|
I managed to get this working by changing the filter to this: I do not understand why with the tagged collection I apparently need to create the "post.date" value as a date object, but in the other collections I do not. |
Beta Was this translation helpful? Give feedback.
-
|
re: If I’m reading correctly it’s saying one or more |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I see a similar question was asked a few days ago, but I think this is slightly different. I have a page which lists all posts of a tag (tagged.njk), it is based on this quick tip on the eleventy site.
I am trying group all the posts on that page by year. The code in tagged.njk looks like this:
And the groupByYear filter looks like this in eleventy.js:
On a usual collection this works, but using the above "tag" based collection, I get this error:
As far as I can tell, this is telling me I can't call "getFullYear" on the date of these tagged collections. But I don't understand why or if I am doing something wrong.
Thanks for any help,
Robin
Beta Was this translation helpful? Give feedback.
All reactions