Need advice on Weekly Schedule template

Hello everyone! I need to make a template to render a schedule for current week and make it change automatically on Mondays. For now I don’t need to save past schedules but probably I will need to. Also there is no need to create a separate page for each week because there is no interest in the past schedules.

First I need to get current week number which is a non-trivial task. For now I think I’ll write a separate script (cron task) to calculate it, reconfigure hugo site and rebuild it. Still looks like a hack. But there other problems which would require external scripting.

Also I have 7 days to cover and it looks like it would be the right decision to use Data. Each daily activity has same properties like time, type of activity, room # and the like. Splitting weekly schedules into separate files would make a ton of them in a year or two without a pretty way to load the right file. Having a single file would require some kind of selection which is not easy with Data (also no Pagination).

I could also create a content file for each week but I don’t need to have rendered pages, only embed the template in another static page.

So it sounds like a typical task but I can’t figure out the right way to implement it. What would you suggest? Thanks in advance!

A cron job is the way to go for this task.

But what do you mean by:

If you don’t want to display past events you could have a single data file under /data/ that gets updated with the new schedule. Calling that data file in your templates is not that difficult.

Unless I’m missing something regarding your requirements…

I agree, if you don’t need pages (each week/day to generate a web page) you probably shouldn’t use them. Do you know that Hugo can also bring in outside data? https://gohugo.io/templates/data-templates/#data-driven-content I don’t fully understand your question, but that may be something to consider with your use-case.