Here’s a question. What is the best way to render recurring events in a Hugo page?
Many Hugo users might be familiar with this scenario by now:
Your website has an “Events” page and you use a Hugo data file (YAML, TOML, whatever) to store all of the events. Then you use a custom template that uses
where to pick only events in the future and
range to cycle through all of those events and then render them to the events page.
I want to do that but additionally have an event that is maybe, the first Wednesday of every month. Any ideas on how I can accomplish this?
I don’t have any final solution yet but I could imagine three possible implementations:
- Do it in preprocessing. I could have the events in a data file with a cron-like value, and then use a Bash script (or other scripting language) to “expand” that events into the data file itself. Then run Hugo.
- Create a build of Hugo that has a custom function that could accomplish this. I kind of like this route but I don’t know what it would be called or how that would event work.
3 seems the easiest way but is less static. 2 is my favorite option but not sure where to start.
Any comments on my ideas or additional ideas are welcomed.