Hello,
I have the following use-case: I have a data file that holds the trinaing schedule for a club. Using a data template, we render a weekly calendar from that. This works so far.
Now, this calendar has to be updated regularly (fr various reasons) by tweaking the data file. I would like to create a RSS feed of the changes in order to let the members know what has changed in the schedule.
Is this somehow possible with hugo?
I see the problem that the ancient data files are not directly accessible. This might be solvable. However, I have no clue about how to convert this into a feed.
Can you help me?
Christian
Please provide a sample of the data file, and its path from the root of your project directory. Whether or not you can display a “diff” (added, removed, changed) will depend on the data structure.
Hello and sorry for the late reply.
The data file (as currently present) looks like this. It would generally be possible to change the format of this file in general.
My understanding is that the ancient versions of the data need to be accessible to Hugo to build the feed but I am not sure if I get thispoint right. In the git VCS the history is present for sure. But I wanted to clarify this…
Christian
My thought was to two compare two datasets:
data/
└── calendar/
├── current.json
└── previous.json
Each dataset would need to be an array of maps, each with a unique id:
{
"id-001": {
"date": "2024-05-01",
"time": "10:00:00",
"title": "Foo",
"slots": 6
},
"id-002": {
"date": "2024-05-01",
"time": "14:00:00",
"title": "Bar",
"slots": 7
}
}
The comparison needs to identify events that have been:
If you need something more complex than this you’ll need to find another way.
Do you have an example on how to handle this if there was a unique identifier for the events? I might be able to run some Cron script or similar to look at the history of the data file, make some diff (e.g. in Python) and then create a new commit with the matching files present.
I would then need to understand what/how these additional files would need to be build like. Also, an example or at least a hint on how to handle these (assume they follow your suggested structure) would be much appreciated.
Thanks
Christian