ics calendar #265

Merged
paspo merged 6 commits from paspo/bglug.it:ics-calendar into main 2024-10-02 13:22:49 +00:00
5 changed files with 79 additions and 0 deletions
Showing only changes of commit fe340ce68c - Show all commits

View File

@ -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
amreo marked this conversation as resolved
Review

Si riesce a distinguerlo per lingua e a renderlo relativo?

Si riesce a distinguerlo per lingua e a renderlo relativo?
Review

non senza stravolgere (ancora) il tema

non senza stravolgere (ancora) il tema
- 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

View File

@ -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
---

View File

@ -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
---

View File

@ -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;
}

43
layouts/events/list.ics Normal file
View File

@ -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 }}
amreo marked this conversation as resolved Outdated
Outdated
Review

Non ho capito. Come dove trova il parametro location? Idem data inizio/fine evento?

Non ho capito. Come dove trova il parametro location? Idem data inizio/fine evento?
Outdated
Review

lo imposti nel front matter

location_link: "[fablab bergamo](https://www.fablabbergamo.it/)"
location_ics: FabLab Bergamo - via Mauro Gavazzeni, 3 - Bergamo
locations: fablab
lo imposti nel [front matter](https://git.libreschool.org/BgLUG/bglug.it/wiki/front-matter) ```yaml location_link: "[fablab bergamo](https://www.fablabbergamo.it/)" location_ics: FabLab Bergamo - via Mauro Gavazzeni, 3 - Bergamo locations: fablab ```
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" . }}
amreo marked this conversation as resolved Outdated
Outdated
Review

questa è la data di ultima modifica.
Hugo la ricava dal timestamp dell'history git del file.
Serve perchè se aggiorni l'evento, viene cambiato questo valore nel file ICS e il client sa che lo deve parsare di nuovo.

[questa](https://gohugo.io/methods/page/lastmod/) è la data di ultima modifica. Hugo la ricava dal timestamp dell'history git del file. Serve perchè se aggiorni l'evento, viene cambiato questo valore nel file ICS e il client sa che lo deve parsare di nuovo.
{{ end -}}
{{ if .Date }}DTSTART;TZID=Europe/Rome:{{dateFormat "20060102T150405Z" .Date }}
{{- $d := time.AsTime .Date }}
{{- $duration := .Params.duration | default "1h" }}
amreo marked this conversation as resolved Outdated
Outdated
Review

Questa è la durata dell'evento. Lo imposti nel front-matter come duration:, e se non lo fai, si considera 1 ora.

Questa è la durata dell'evento. Lo imposti nel front-matter come `duration:`, e se non lo fai, si considera 1 ora.
DTEND;TZID=Europe/Rome:{{dateFormat "20060102T150405Z" ($d.Add (time.ParseDuration $duration) ) }}
{{ end -}}
END:VEVENT
{{end -}}
END:VCALENDAR