Skip to content

Instantly share code, notes, and snippets.

@lislis
Last active October 5, 2021 11:52
Show Gist options
  • Save lislis/2f9b8c51a64cc31c38f9bb83c1da9a35 to your computer and use it in GitHub Desktop.
Save lislis/2f9b8c51a64cc31c38f9bb83c1da9a35 to your computer and use it in GitHub Desktop.
Hugo ical template
title slug date summary end location organizer
Event title
event-title
2020-03-02T19:30:00+01:00
the standard says this should be less than 75 characters!
2020-03-02T22:00:00+01:00
Event location if known
name email
Your name
your@email.com

Something about your event

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//name of your calendar//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
{{range .Pages}}
BEGIN:VEVENT
{{ with .Params.organizer}}ORGANIZER;CN="{{ .name }}":mailto:{{ .email }}{{ end }}
SUMMARY:{{.Title}}
DESCRIPTION:{{.Params.summary}}
UID:{{dateFormat "20060102T150405" .Date}}@yoursite
SEQUENCE:0
STATUS:CONFIRMED
DTSTAMP:{{dateFormat "20060102T150405" .Date}}
DTSTART:{{dateFormat "20060102T150405" .Date}}
{{ with .Params.recurring}}RRULE:FREQ=WEEKLY;BYDAY=MO{{ end}}
{{ with .Params.end }}DTEND:{{dateFormat "20060102T150405" .}}{{ end }}
LOCATION:{{with .Params.location}}{{.}}{{else}}TBD{{end}}
URL:{{.Permalink}}
END:VEVENT
{{end}}
END:VCALENDAR
@maxhellwig
Copy link

Thank you very much for your example!
Just a note, but I changed the DESCRIPTION field a little bit to make use of the content summary auto split functionality:

DESCRIPTION:{{.Summary}}

https://gohugo.io/content-management/summaries/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment