Create one ICS file that contains all events?

Hi,

I can see from searching that I can create separate index.ics files for all my individual events.

  1. Add outputs entry to frontmatter for individual events (request HTML and Calendar)
  2. Add single.ics file to layouts/events directory

This works fine. All of my events have their own index.html file and index.ics file.

Is there any way to get an overall events/index.ics file that contains multiple events?

Thanks,
Crawford.

I assume that there is no obvious option within hugo that I am missing.

I can solve this by letting hugo create individual ics files that contain VEVENT’s and run an additional script to collect all these separate files in to a single overall index.ics file.

Just iterate over the events using a list template, and generate one file with:

//header info

BEGIN:VEVENT
...
END:VEVENT

BEGIN:VEVENT
...
END:VEVENT

// footer info

Thanks.

I was already thinking that because I had set Calander (and html) in the list of outputs in my frontmatter for events, this would result in hugo automatically invoking a list template for me. I tried creating a file called layouts/events/list.ics for this purpose but this had no affect.

I will go back in review the documentation again and see if I can identify the best place to add my list template and use this to generate my file in events/index.ics.

Either of these will work:

layouts/events/
β”œβ”€β”€ list.ics
└── single.ics
layouts/events/
β”œβ”€β”€ list.calendar.ics
└── single.calendar.ics

layouts/events/list.ics (basic concept)

{{- range .Pages -}}
BEGIN:VEVENT
{{ .Params.event_start }}
{{ .Params.event_end }}
END:VEVENT
{{- end -}}

content/events/_index.md

+++
title = 'Events'
date = 2022-12-29T11:06:08-08:00
draft = false
[cascade]
outputs = ['HTML','Calendar']
+++

2 Likes

I have got this working correctly with a layouts/events/list.ics file.
My earlier attempts failed due to lack of content/events/_index.md file which I had not previously required.

Thanks, Crawford.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.