{{ .Title }}
{{- .Content -}} {{ $eventsPath := (printf "data/%s/events/events%s.toml" $.Language.Lang (dateFormat "2006" now)) }} {{ $eventsData := "" }} {{ if (fileExists $eventsPath) -}} {{ $data := index .Site.Data $.Language.Lang }} {{ $eventsData = $data }} {{ else }} - {{ $dataDefaultLanguage := index .Site.Data .Sites.First.Language.Lang }} + {{ $dataDefaultLanguage := index .Site.Data .Sites.Default.Language.Lang }} {{ $eventsData = $dataDefaultLanguage }} {{ end }} {{ $countriesCodes := slice }} {{ $countriesCodesTimes := newScratch }} {{ with $eventsData }} {{ range (sort .events "year" "desc") }} {{ range .events }} {{ if .countryCode }} {{ $countriesCodes = $countriesCodes | append .countryCode }} {{ if $countriesCodesTimes.Get .countryCode }} {{ $countriesCodesTimes.Add .countryCode 1 }} {{ else }} {{ $countriesCodesTimes.Set .countryCode 1 }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ $countriesCodes = $countriesCodes | uniq }} {{ $countriesTimes := slice }} {{ range $element := $countriesCodes }} {{ $countriesTimes = $countriesTimes | append ($countriesCodesTimes.Get .) }} {{ end }} {{ $eventsImageUrl := (printf "https://chart.googleapis.com/chart?cht=t&chs=400x200&chtm=world&chco=ffffff,ffbe38,600000&chf=bg,s,4D89F9&chd=t:%s&chld=%s" (delimit $countriesTimes ",") (delimit $countriesCodes "")) }} {{ $eventsCounter := 0 }} {{ if isset .Params "year" }} {{ else }} {{ $yearsMonthsCP := slice }} {{ with $eventsData }} {{ range first 3 (sort .events "year" "desc") }} {{ range (sort .events "startDate" "asc") }} {{ if ge (dateFormat "20060102" .endDate) (dateFormat "20060102" now) }} {{ $yearsMonthsCP = $yearsMonthsCP | append (dateFormat "2006-1" .endDate) }} {{ end }} {{ end }} {{ end }} {{ end }} {{ $yearsMonthsPast := slice }} {{ with $eventsData }} {{ range first 3 (sort .events "year" "desc") }} {{ range (sort .events "startDate" "asc") }} {{ if lt (dateFormat "20060102" .endDate) (dateFormat "20060102" now) }} {{ $yearsMonthsPast = $yearsMonthsPast | append (dateFormat "2006-1" .endDate) }} {{ end }} {{ end }} {{ end }} {{ end }} {{ $yearsMonthsCP = $yearsMonthsCP | uniq }} {{ $yearsMonthsPast = $yearsMonthsPast | uniq }} {{ $maxYear := now.Year }} {{ $maxYear = add $maxYear 1}} {{ $minYear := now.Year }} {{ $minYear = sub $minYear 2}}{{ i18n "currentEvents" }}
{{ range $year := seq $minYear $maxYear }} {{ range $month := seq 1 12 }} {{ $yearMonth := (printf "%d-%d" $year $month) }} {{ if in $yearsMonthsCP $yearMonth }}{{ i18n $month }} {{ $year }}
{{ with $eventsData }}-
{{ range first 3 (sort .events "year" "desc") }}
{{ range (sort .events "startDate" "asc") }}
{{ if and (ge (dateFormat "20060102" .endDate) (dateFormat "20060102" now)) (eq (dateFormat "2006-1" .endDate) $yearMonth) }}
-
{{ .name }}, {{ .site }}, {{ .city }}, {{ .country }}
{{ dateFormat "02 January, 2006" .startDate }} - {{ dateFormat "02 January, 2006" .endDate }}
{{ .description | safeHTML }}
{{ $eventsCounter = add $eventsCounter 1 }}
{{ end }}
{{ end }}
{{ end }}
{{ i18n "pastEvents" }}
{{ range $year := seq now.Year $minYear }} {{ range $month := seq 12 1 }} {{ $yearMonth := (printf "%d-%d" $year $month) }} {{ if in $yearsMonthsPast $yearMonth }}{{ i18n $month }} {{ $year }}
{{ with $eventsData }}-
{{ range first 3 (sort .events "year" "desc") }}
{{ range (sort .events "startDate" "desc") }}
{{ if and (lt (dateFormat "20060102" .endDate) (dateFormat "20060102" now)) (eq (dateFormat "2006-1" .endDate) $yearMonth) }}
-
{{ .name }}, {{ .site }}, {{ .city }}, {{ .country }}
{{ dateFormat "02 January, 2006" .startDate }} - {{ dateFormat "02 January, 2006" .endDate }}
{{ .description | safeHTML }}
{{ $eventsCounter = add $eventsCounter 1 }}
{{ end }}
{{ end }}
{{ end }}
{{ i18n "pastEvents" }}
{{ range $month := seq 12 1 }} {{ $yearMonth := (printf "%d-%d" $year $month) }} {{ if in $yearsMonthsSelected $yearMonth }}{{ i18n $month }} {{ $year }}
{{ with $eventsSelectedYear }}-
{{ range (sort .events "startDate" "desc") }}
{{ if and (lt (dateFormat "20060102" .endDate) (dateFormat "20060102" now)) (eq (dateFormat "2006-1" .endDate) $yearMonth) }}
-
{{ .name }}, {{ .site }}, {{ .city }}, {{ .country }}
{{ dateFormat "02 January, 2006" .startDate }} - {{ dateFormat "02 January, 2006" .endDate }}
{{ .description | safeHTML }}
{{ $eventsCounter = add $eventsCounter 1 }}
{{ end }}
{{ end }}
Events from past years:
{{ if .GitInfo }}{{ i18n "last-modified" }}: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} {{ .GitInfo.AuthorName }}