So I’m trying to build a quick page listing event details with Hugo (first time working with Hugo, so bear with me). I figured I would put the events into json files and load them as data templates. I want to offer multiple view of the events (e.g. by category, by year, upcoming…) so my thinking was using data templates would give me the most flexibility.
I’ve put the two categories of events into two JSON files and added them to /data/events/aevents.json and /data/events/bevents.json
Sample json
{
"devcon 1": {"evname": "Dev Con 1", "year": "2019", "date": "2020-05-12T23:29:49Z"},
"devcon2": {"evname": "Dev Con 1", "year": "2018", "date": "2018-05-12T23:29:49Z"}
}
Now when I use
{{ range .Site.Data.events.aevents }}
things work as expected.But they don’t when I use
{{ range .Site.Data.events }}
which I thought would give me events from aevents.json and bevents.json.
Second part
The json events have a date property. When I try to filter to just show upcoming events, my list is blank. I’ve been playing with variants of this:
{{ range where .Site.Data.events.aevents "date" "ge" now }}
and have tried a bunch of different date formats. Any tips on where I might be going wrong?