diff --git a/layouts/_default/home.calendar.ics b/layouts/_default/home.calendar.ics index 2ad3dee..271a377 100644 --- a/layouts/_default/home.calendar.ics +++ b/layouts/_default/home.calendar.ics @@ -1,3 +1,4 @@ +{{- $numcaratteri := 66 }} BEGIN:VCALENDAR VERSION:2.0 PRODID:-//BgLUG//BgLUG Events Calendar//EN @@ -5,18 +6,6 @@ X-WR-CALNAME:BgLUG Events Calendar X-WR-TIMEZONE:Europe/Rome CALSCALE:GREGORIAN METHOD:PUBLISH -{{- range where .Site.Pages ".Page.Params.add_to_ics" true -}} -{{- $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:VTIMEZONE TZID:Europe/Rome LAST-MODIFIED:20240422T053451Z @@ -37,6 +26,25 @@ DTSTART:19701025T030000 RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU END:STANDARD END:VTIMEZONE +{{- range where .Site.Pages ".Page.Params.add_to_ics" true -}} + {{- $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 }} + {{- $description := "" }} + {{- with .Description }} + {{- $description = . }} + {{- end }} + {{- with .Summary }} + {{- $description = . }} + {{- end }} BEGIN:VEVENT SUMMARY:{{.Title}} ORGANIZER;{{ .Site.Param "ics.organizer" }} @@ -44,6 +52,18 @@ UID:{{ md5 .Permalink }}@bglug.it SEQUENCE:0 STATUS:CONFIRMED TRANSP:TRANSPARENT + + {{- if ne $description "" }} + {{- $description = replace $description "\n" " " }} + {{- $description = (print "DESCRIPTION:" $description ) | truncate 400 }} + {{- $l := $description | len }} + {{- $i := 0 }} + {{- range seq 0 $numcaratteri $l }} +{{ strings.Repeat $i " " }}{{- substr $description . $numcaratteri }} + {{- $i = add $i 1 }} + {{- end }} + + {{- end }} LOCATION:{{ $location }} URL:{{ .Permalink }} {{ with .Lastmod }}DTSTAMP:{{dateFormat "20060102T150405Z" . }}