diff --git a/config.yml b/config.yml index e79e131..c0ae508 100644 --- a/config.yml +++ b/config.yml @@ -10,7 +10,10 @@ copyright: 2024 © Bergamo Linux Users Group paginate: 20 timeout: 1800s enableRobotsTXT: true +enableGitInfo: true params: + ics: + organizer: CN="BgLUG":MAILTO:info@bglug.it description: Bergamo Linux Users Group social: - title: Mattermost @@ -41,6 +44,10 @@ params: icon: fa-mail-bulk pack: solid url: https://lists.linux.it/listinfo/bglug + - title: Events Caledar + icon: fa-calendar-alt + pack: solid + url: https://bglug.it/it/eventi/index.ics - title: Facebook icon: fa-facebook-f pack: brands @@ -209,6 +216,16 @@ languages: defaultContentLanguage: it defaultContentLanguageInSubdir: true +outputFormats: + calendar: + baseName: index + isPlainText: true + mediaType: text/calendar + noUgly: false + permalinkable: false + root: false + protocol: webcal:// + outputs: home: - html @@ -220,6 +237,7 @@ outputs: - rss section: - html + - calendar - rss taxonomy: - html diff --git a/content/events/_index.en.md b/content/events/_index.en.md index 726fb10..bbbe92b 100644 --- a/content/events/_index.en.md +++ b/content/events/_index.en.md @@ -3,4 +3,11 @@ type: section title: Events #description: "TODO: please fill this with a description" sidebar_right: sidebar-eventi +output: + - calendar: + mediaType: text/calendar +mediaTypes: + text/calendar: + suffixes: + - ics --- diff --git a/content/events/_index.it.md b/content/events/_index.it.md index 2059342..236c850e 100644 --- a/content/events/_index.it.md +++ b/content/events/_index.it.md @@ -3,4 +3,11 @@ type: section title: Eventi #description: "TODO: non so come descrivere la sezione eventi" sidebar_right: sidebar-eventi +output: + - calendar: + mediaType: text/calendar +mediaTypes: + text/calendar: + suffixes: + - ics --- diff --git a/docker/rootfs/etc/nginx/http.d/default.conf b/docker/rootfs/etc/nginx/http.d/default.conf index 7961041..2bc5954 100644 --- a/docker/rootfs/etc/nginx/http.d/default.conf +++ b/docker/rootfs/etc/nginx/http.d/default.conf @@ -12,6 +12,10 @@ server { rewrite ^/feed/.*$ /it/index.xml last; } + location ~ /events/elenco/ { + try_files $uri /it/eventi/index.ics; + } + location ~ ^/wp\-content/uploads/2008/02/Statuto\.pdf$ { return 301 https://bglug.it/it/chi-siamo/Statuto.pdf; } diff --git a/layouts/events/list.ics b/layouts/events/list.ics new file mode 100644 index 0000000..047cb0b --- /dev/null +++ b/layouts/events/list.ics @@ -0,0 +1,43 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//BgLUG//BgLUG Events Calendar//EN +X-WR-CALNAME:BgLUG Events Calendar +X-WR-TIMEZONE:Europe/Rome +CALSCALE:GREGORIAN +METHOD:PUBLISH + +{{range .Pages -}} + +{{- $location := "" -}} +{{- $locations := .Params.locations -}} +{{- with (eq (printf "%T" $locations ) "string" ) -}} + {{- $location = $locations -}} +{{- end -}} +{{- with (eq (printf "%T" $locations ) "[]string" ) -}} + {{- $location = (index $locations 0) -}} +{{- end -}} +{{ if .Params.location_ics }} + {{- $location = .Params.location_ics }} +{{- end }} + +BEGIN:VEVENT +SUMMARY:{{.Title}} +ORGANIZER;{{ .Site.Param "ics.organizer" }} +UID:{{ md5 .Permalink }}@bglug.it +SEQUENCE:0 +STATUS:CONFIRMED +TRANSP:TRANSPARENT +LOCATION:{{ $location }} +URL:{{ .Permalink }} +{{ with .Lastmod }}DTSTAMP:{{dateFormat "20060102T150405Z" . }} +{{ end -}} +{{ if .Date }}DTSTART;TZID=Europe/Rome:{{dateFormat "20060102T150405Z" .Date }} +{{- $d := time.AsTime .Date }} +{{- $duration := .Params.duration | default "1h" }} +DTEND;TZID=Europe/Rome:{{dateFormat "20060102T150405Z" ($d.Add (time.ParseDuration $duration) ) }} +{{ end -}} +END:VEVENT + +{{end -}} + +END:VCALENDAR