I am trying to build an events calendar into a project, and am struggling how to approach it. I am pretty new to Kirby, but I have looked through the forums and canât quite find the answer to what I am looking for. Apologies for the wall of text!
tldr; I canât figure out a good way to create an events calendar with repeating events and a list/detail setup that doesnât create duplicate page URLs or require manual intervention from the editor.
At the most basic, each event requires:
- eventTitle
- eventStartDate
- eventStartTime
Itâs important to note, though, that some events repeat, and so wouldnât have a unique Title. Think âQuarterly reviewâ.
I went down the path of using mzurâs calendar plugin, and this seems promising. The plugin is based around the structure field, which is a good option for a bunch of repeating events mixed in with more detailed events. Itâs easy to duplicate rows and modify the non-common data, like the date, which makes adding a bunch of events easy for the editor. I have that working just fine, but I end up with just a basic list view, where ideally I also need a detail page view, with a unique shareable URL and a place to output the sometimes blog-like post info for some âflagshipâ events.
My actual question:
Hereâs where I get stuck: how would I then generate a separate (virtual) page for every item within the events structure field? (Is that even the right question to be asking?)
I thought about trying to generate a slug, but it appears the slug âsyncâ option only works with a single field, so entries with the same title would generate the same slug.
I have also tried a different approach using pages:
While trying to implement the events calendar using pages (/events/eventPage) rather than the structure field I run into a similar problem: unless the editor types the date into the title field when creating the page (or otherwise makes it unique) I canât have the page url be /events/eventStartDate-eventTitle. I have looked at a page model that appends todayâs date to the field, but that doesnât really solve the problem as I need the URL/slug to be made unique by combining the event start date with the event title, so I end up with ex:
/events/2023-09-08-review-meeting
/events/2023-10-10-review-meeting
/events/2023-11-06-review-meeting
etc.
It may be possible to use the Custom Add Fields Plugin â I havenât tried this yet â but this I presume only works when generating a new page. So if duplicating a page the URL would have to be manually updated, rather than being dynamically regenerated from the event_start field within the pageâs blueprint.
Am I missing something obvious?
So far my experience with Kirby has been fantastic, and thereâs always been a solution to whatever I am trying to do. This seems like an obvious use case, so what am I missing here?
Thanks!