ics calendar #265
18
config.yml
18
config.yml
@ -10,7 +10,10 @@ copyright: 2024 © Bergamo Linux Users Group
|
|||||||
paginate: 20
|
paginate: 20
|
||||||
timeout: 1800s
|
timeout: 1800s
|
||||||
enableRobotsTXT: true
|
enableRobotsTXT: true
|
||||||
|
enableGitInfo: true
|
||||||
params:
|
params:
|
||||||
|
ics:
|
||||||
|
organizer: CN="BgLUG":MAILTO:info@bglug.it
|
||||||
description: Bergamo Linux Users Group
|
description: Bergamo Linux Users Group
|
||||||
social:
|
social:
|
||||||
- title: Mattermost
|
- title: Mattermost
|
||||||
@ -41,6 +44,10 @@ params:
|
|||||||
icon: fa-mail-bulk
|
icon: fa-mail-bulk
|
||||||
pack: solid
|
pack: solid
|
||||||
url: https://lists.linux.it/listinfo/bglug
|
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
|
|||||||
- title: Facebook
|
- title: Facebook
|
||||||
icon: fa-facebook-f
|
icon: fa-facebook-f
|
||||||
pack: brands
|
pack: brands
|
||||||
@ -209,6 +216,16 @@ languages:
|
|||||||
defaultContentLanguage: it
|
defaultContentLanguage: it
|
||||||
defaultContentLanguageInSubdir: true
|
defaultContentLanguageInSubdir: true
|
||||||
|
|
||||||
|
outputFormats:
|
||||||
|
calendar:
|
||||||
|
baseName: index
|
||||||
|
isPlainText: true
|
||||||
|
mediaType: text/calendar
|
||||||
|
noUgly: false
|
||||||
|
permalinkable: false
|
||||||
|
root: false
|
||||||
|
protocol: webcal://
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
home:
|
home:
|
||||||
- html
|
- html
|
||||||
@ -220,6 +237,7 @@ outputs:
|
|||||||
- rss
|
- rss
|
||||||
section:
|
section:
|
||||||
- html
|
- html
|
||||||
|
- calendar
|
||||||
- rss
|
- rss
|
||||||
taxonomy:
|
taxonomy:
|
||||||
- html
|
- html
|
||||||
|
@ -3,4 +3,11 @@ type: section
|
|||||||
title: Events
|
title: Events
|
||||||
#description: "TODO: please fill this with a description"
|
#description: "TODO: please fill this with a description"
|
||||||
sidebar_right: sidebar-eventi
|
sidebar_right: sidebar-eventi
|
||||||
|
output:
|
||||||
|
- calendar:
|
||||||
|
mediaType: text/calendar
|
||||||
|
mediaTypes:
|
||||||
|
text/calendar:
|
||||||
|
suffixes:
|
||||||
|
- ics
|
||||||
---
|
---
|
||||||
|
@ -3,4 +3,11 @@ type: section
|
|||||||
title: Eventi
|
title: Eventi
|
||||||
#description: "TODO: non so come descrivere la sezione eventi"
|
#description: "TODO: non so come descrivere la sezione eventi"
|
||||||
sidebar_right: sidebar-eventi
|
sidebar_right: sidebar-eventi
|
||||||
|
output:
|
||||||
|
- calendar:
|
||||||
|
mediaType: text/calendar
|
||||||
|
mediaTypes:
|
||||||
|
text/calendar:
|
||||||
|
suffixes:
|
||||||
|
- ics
|
||||||
---
|
---
|
||||||
|
@ -12,6 +12,10 @@ server {
|
|||||||
rewrite ^/feed/.*$ /it/index.xml last;
|
rewrite ^/feed/.*$ /it/index.xml last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ~ /events/elenco/ {
|
||||||
|
try_files $uri /it/eventi/index.ics;
|
||||||
|
}
|
||||||
|
|
||||||
location ~ ^/wp\-content/uploads/2008/02/Statuto\.pdf$ {
|
location ~ ^/wp\-content/uploads/2008/02/Statuto\.pdf$ {
|
||||||
return 301 https://bglug.it/it/chi-siamo/Statuto.pdf;
|
return 301 https://bglug.it/it/chi-siamo/Statuto.pdf;
|
||||||
}
|
}
|
||||||
|
43
layouts/events/list.ics
Normal file
43
layouts/events/list.ics
Normal 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
amreo
commented
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?
paspo
commented
lo imposti nel front matter
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
paspo
commented
questa è la data di ultima modifica. [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
paspo
commented
Questa è la durata dell'evento. Lo imposti nel front-matter come 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
|
Loading…
x
Reference in New Issue
Block a user
Si riesce a distinguerlo per lingua e a renderlo relativo?
non senza stravolgere (ancora) il tema