I’m working on a feature to support recurring events on a Hugo page. To do so, my approach is as follows: in the Front Matter, I add recurrence: (which can be set to weekly or monthly) and recurrence_end to define until when the recurrence has to be taken into account.
Then on the page I go through all events and add “new” events. My approach to add these “new” events is to copy the current event and then modify the dates accordingly.
But Hugo complains about {{ $event.date := $date }} with unexpected ":=" in operand. My question is now, how can I modify the date (and other params in the Front Matter) of a copy of an event?
git clone --single-branch -b hugo-forum-topic-37389 https://github.com/jmooring/hugo-testing hugo-forum-topic-37389
cd hugo-forum-topic-37389
hugo server
Be advised that the .AddDate method produces results that are “expected” by the Go team, but certainly not expected by me.
Thanks a lot @jmooring for the example. I did learn a lot from it. There is a last problem I’m facing.
Within {{ range sort $events "Date" }}{{ end }} (lines 47-52), I seem to have no access to .Page. E.g. {{with .Page.GetPage "/act/events"}}{{.Params.learn_more}}{{end}} doesn’t give me anything back.