I want to display a list of events, coming from an JSON API, grouped by their months. How can I achieve this, without changing the returning JSON object itself?
The JSON object format is something like
"time" : "2006-01-02T15:04:05Z07:0000Z",
Some possible solutions could be:
- The RESTful API could take the month as parameter and just return specific events
- Creating a map in the template. (Is this possible or does exists a function for grouping JSON objects?)
- Some ugly stuff during ranging all objects and try to check if the previous month is different and create group header by change.
Or does a other way exists to use the section build-in functionality of Hugo in combination with an JSON array?