iCal, recurring events

Hello community!

I have a project, where some posts are invitations to events noted in frontmatter and I am pretty happy to be able to export this to ical files.

But some events have complex recurrence schemes and I wonder, how I could implement this. I would like to be able to represent them humanreadable on the page, be able to sort for next upcoming event and export it to the ical file.

I would be grateful for ideas, how to make this possible, if thats possible. If not, is this a feature worth proposing at github?

My question before guiding you further,
Based on iCalendar file format can you, using notepad, create ICS file that will contain all that you got in frontmatter?

If that’s possible then you can look into Hugo to help you with that.

You would need to specify custom output file format and then create a template on how it will take information from frontmatter and use it in the custom output file. Then link to the file in your post.

[outputs]
  page = ['HTML', 'Calendar']

If you can achieve the first bit by creating ICS file manually then shall not be a problem to figure something out to make this automatic for you.

Yes, I did all that successfully. But I cant wrap my head around the question: how do I implement multiple recurrent events (every sunday, but not, when its the first day and the first sundy in month and ever thursday but only this month.

If i can wish for something, than it would be, that hugo can work with the ical scheme. (its easy to create, but hard to parse with hugo for me.)

Something like this: GitHub - teambition/rrule-go: Go library for working with recurrence rules for calendar dates.

Is that possible in iCalendar format?

Is not as hard as you thing. Look for example in Sitemap that generating XML file from data in posts or Structured Data (Schema) that can be fully customised and work nicely in hugo.

As mentioned.

Have a look at how the iCalendar File is constructed then match what you got in frontmatter with that file. Once you got that done the template for Hugo can be made.

Show your frontmater example and your match with icalendar file format and we can see what can be done next.

RRULE=FREQ=MONTHLY;INTERVAL=4;BYDAY=4FR;UNTIL=20220824T000000Z
Every fourth Month, every fourth Friday until 2022-08-24.

RRULE=FREQ=YEARLY;BYSETPOS=1;BYDAY=TU;BYMONTH=4;COUNT=4
Every Year, first thuesday of April, four occurrences.

Maybe I exaggerated the complexity of that iCal string but I cant wrap my head around a solution to parse this string, and get the next occurrence, let alone do this for all events and sort by it.

Right now, I create that string with a quick and dirty editor, copy it to Frontmatter. The string than gets copied to *.ical and that works fine. But parsing this string, with all the different possibilitys is kinda hard for me.

Could you paste your frontmater example.