diff --git a/layouts/events/single.html b/layouts/events/single.html index 9369c6a0e..8d4afefcc 100644 --- a/layouts/events/single.html +++ b/layouts/events/single.html @@ -17,8 +17,8 @@

Future

{{- $.Scratch.Set "year" (dateFormat "2006" .startdate) -}} {{- $.Scratch.Set "year-displayed" "false" -}} {{- end -}} - {{- if ne ($.Scratch.Get "month") (dateFormat "January" .startdate ) -}} - {{- $.Scratch.Set "month" (dateFormat "January" .startdate ) -}} + {{- if ne ($.Scratch.Get "month") (dateFormat "January 2006" .startdate ) -}} + {{- $.Scratch.Set "month" (dateFormat "January 2006" .startdate ) -}} {{- $.Scratch.Set "month-displayed" "false" -}} {{- end -}} {{- if ne ($.Scratch.Get "month-displayed") "true" -}} @@ -26,7 +26,7 @@

Future

{{- end -}}
-

{{ dateFormat "January" .startdate }}

+

{{ dateFormat "January 2006" .startdate }}

{{- $.Scratch.Set "month-displayed" "true" -}} {{- $.Scratch.Set "close-tag" "true" -}} {{- end -}} @@ -61,6 +61,57 @@

TBD

{{- end -}}
-{{- partial "past.html" . -}} + +
+
+

Past

+
+
+{{- range sort $.Site.Data.events "startdate" "desc" -}} + {{- if .startdate -}} + {{- if le (time .enddate) now -}} + {{- if ne ($.Scratch.Get "year") (dateFormat "2006" .startdate) -}} + {{- $.Scratch.Set "year" (dateFormat "2006" .startdate) -}} + {{- $.Scratch.Set "year-displayed" "false" -}} + {{- end -}} + {{- if ne ($.Scratch.Get "year") (dateFormat "2006" .startdate) -}} + {{- $.Scratch.Set "year" (dateFormat "2006" .startdate) -}} + {{- $.Scratch.Set "year-displayed" "false" -}} + {{- end -}} + {{- if ne ($.Scratch.Get "month") (dateFormat "January 2006" .startdate ) -}} + {{- $.Scratch.Set "month" (dateFormat "January 2006" .startdate ) -}} + {{- $.Scratch.Set "month-displayed" "false" -}} + {{- end -}} + {{- if ne ($.Scratch.Get "month-displayed") "true" -}} + {{- if eq ($.Scratch.Get "close-tag") "true"}} + + {{- end -}} +
+

{{ dateFormat "January 2006" .startdate }}

+ {{- $.Scratch.Set "month-displayed" "true" -}} + {{- $.Scratch.Set "close-tag" "true" -}} + {{- end -}} + {{- if ne .startdate .enddate }} + {{- if eq (time .startdate).Month (time .enddate).Month -}} + + {{ dateFormat "Jan 2" .startdate }} - {{ dateFormat "2" .enddate }}: + {{ .city }} +
+ {{- else -}} + + {{ dateFormat "Jan 2" .startdate }} - {{ dateFormat "Jan 2" .enddate }}: + {{ .city }} +
+ {{- end -}} + {{- else -}} + + {{ dateFormat "Jan 2" .startdate }}: + {{ .city }} +
+ {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} + {{ end }} diff --git a/layouts/partials/past.html b/layouts/partials/past.html deleted file mode 100644 index 702da1290..000000000 --- a/layouts/partials/past.html +++ /dev/null @@ -1,45 +0,0 @@ -{{/* Scan through a range of years and look in data/events for events during these years. -If found, store year in "active_years" scratch in order to get back to that year later. -Also save the event name under scratch with the ID of the scratch equal to the year number. - -Chomping .year has the nice effect of turning an int into string. */}} -{{- range seq 2009 2020 -}} - {{- $r_year := . -}} - {{- range $.Site.Data.events -}} - {{- if .startdate -}} - {{- $my_year := string ((dateFormat "2006" .enddate )) -}} - {{- if and (eq $my_year (string $r_year)) ( lt (dateFormat "2006-01-02" .enddate) (dateFormat "2006-01-02" (dateFormat "2006-01-02" now))) -}} - {{- $.Scratch.SetInMap "active_years" (print (chomp $my_year)) (print (chomp $my_year)) -}} - {{- $.Scratch.SetInMap (print (chomp $my_year)) .enddate (.name) -}} - {{- end -}} - {{- end -}} - {{- end -}} -{{- end -}} - -
-
-

Past

-
-
-
- {{/* Now scan through all the years that were marked as active in order to print the headline */}} - {{- range ($.Scratch.GetSortedMapValues "active_years") -}} -
-

{{ . }}

- {{- $.Scratch.Set "the_year" . -}} -
- {{/* Finally, scan throug the scratch with the ID of that year and print all the events sorted by startdate - Chomping here in order to convert int to string */}} - {{- range sort $.Site.Data.events "startdate" -}} - {{- if .startdate -}} - {{- if eq ( print (chomp (dateFormat "2006" .startdate))) (print (chomp ($.Scratch.Get "the_year"))) -}} - {{- $.Scratch.Set "citydisplay" .city -}} - {{ $.Scratch.Get "citydisplay" }} -
- {{- end -}} - - {{- end -}} - {{- end -}} -
- {{- end -}} -