-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathevents-archive.html
More file actions
160 lines (154 loc) · 6.36 KB
/
events-archive.html
File metadata and controls
160 lines (154 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{{ define "title" }}
<title>{{ .Title }} - {{ .Site.Title }}</title>
{{ end }} {{ define "head" }} {{ range .AlternativeOutputFormats -}}
<link
rel="{{ .Rel }}"
type="{{ .MediaType.Type }}"
href="{{ .Permalink | safeURL }}"
/>
{{ end -}}
<meta property="og:title" content="{{ .Site.Title }} {{ .Title }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ .Permalink }}" />
{{ with .Params.img_header }}
<meta property="og:image" content="{{ . }}" />
{{ end }} {{ with .Params.meta }}
<meta property="og:description" content="{{ . }}" />
<meta name="description" content="{{ . }}" />
{{ end }} {{ end }} {{ define "main" }}
<main>
<section class="container l__projects js-shuffle">
<div class="row">
<h1 class="col col-12 col-sm-10 mb-2">
{{ if .Params.blurb }}{{ .Params.blurb }}{{ else }}{{ .Title }}{{ end }}
</h1>
<div class="events p-4" style="width: 100%">
<!-- responsive grid: 2 columns on typical content widths -->
<ul
style="
display: grid;
grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
gap: 16px;
list-style: none;
padding-left: 0;
margin: 0;
"
>
{{/* Build a list of archived/past events */}} {{ $archive := slice }}
{{ $today := now.Format "2006-01-02" }} {{ $events := where
site.RegularPages "Section" "events" }} {{ range $events }} {{ $p := .
}} {{/* Flags and dates from front matter */}} {{ $flagArchive := or
($p.Params.archive | default false) false }} {{ $singleDate :=
$p.Params.eventdate | default "" }} {{ $startDate :=
$p.Params.eventdatestart | default "" }} {{ $endDate :=
$p.Params.eventdateend | default "" }} {{/* Normalize to a start and
end time */}} {{ if $startDate }} {{ $start := time $startDate }} {{
$end := cond (ne $endDate "") (time $endDate) $start }} {{/* archive:
include if explicitly archived OR event ended before today */}} {{ if
or $flagArchive (lt ($end.Format "2006-01-02") $today) }} {{ $archive
= $archive | append (dict "page" $p "start" $start "end" $end) }} {{
end }} {{ else if $singleDate }} {{ $date := time $singleDate }} {{ if
or $flagArchive (lt ($date.Format "2006-01-02") $today) }} {{ $archive
= $archive | append (dict "page" $p "start" $date "end" $date) }} {{
end }} {{ else }} {{/* If no dates, include only when explicitly
flagged archived */}} {{ if $flagArchive }} {{ $archive = $archive |
append (dict "page" $p "start" (time $p.Date) "end" (time $p.Date)) }}
{{ end }} {{ end }} {{ end }} {{/* Sort most recent first
(descending), with year headers */}} {{ $currentYear := "" }} {{ range
sort $archive "start" "desc" }} {{ $event := .page }} {{ $start :=
.start }} {{ $end := .end }} {{ $year := $start | time.Format "2006"
}} {{ if ne $year $currentYear }} {{ $currentYear = $year }}
<li style="grid-column: 1 / -1; margin: 8px 0 0 0">
<h2 class="mt-3 mb-2">{{ $year }}</h2>
</li>
{{ end }}
<li>
<div
class="card p-2"
style="
border: 1px solid #ddd;
border-radius: 12px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
"
>
<div class="card-body p-2">
<h3 class="card-title mb-1" style="font-size: 1.1rem">
<a href="{{ $event.Permalink }}">{{ $event.Title }}</a>
</h3>
<div
class="d-flex justify-content-start align-items-center py-1"
>
<h4
class="card-subtitle text-muted pr-2"
style="font-size: 0.95rem"
>
{{ if eq $start $end }} {{ $start | time.Format ":date_long"
}} {{ else }} {{ printf "%s – %s" ($start | time.Format
":date_long") ($end | time.Format ":date_long") }} {{ end }}
</h4>
<div>
{{ range $event.Params.tags }}
<span
class="badge"
style="
background-color: rgb(78, 175, 71);
color: white;
padding: 2px 8px;
margin: 2px;
border: 1px solid #ddd;
border-radius: 12px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
"
>
{{ . }}
</span>
{{ end }}
</div>
</div>
{{ with $event.Params.location }}
<h4
class="card-subtitle text-muted py-1"
style="font-size: 0.95rem"
>
<strong>@</strong> {{ . }}
</h4>
{{ end }}
<p class="card-text py-1" style="margin-bottom: 0.5rem">
{{ with $event.Params.summary }}{{ . | markdownify }}{{ else
}}{{ $event.Summary }}{{ end }}
</p>
<div class="py-1">
<a
class="btn btn-sm btn-outline-primary mr-2"
href="{{ $event.Permalink }}"
>
{{ i18n "details" | default "Details" }}
</a>
{{ with $event.Params.link }}
<a
class="btn btn-sm btn-primary"
href="{{ . }}"
target="_blank"
rel="noopener"
>
{{ i18n "external_link" | default "Externe Seite" }}
</a>
{{ end }}
</div>
</div>
</div>
</li>
{{ end }} {{ if eq (len $archive) 0 }}
<li style="grid-column: 1 / -1">
<div class="p-3 text-muted">
{{ i18n "no_archived_events" | default "No archived events yet."
}}
</div>
</li>
{{ end }}
</ul>
</div>
</div>
</section>
</main>
{{ end }}