Structuur aanbrengen in weergave van events

This commit is contained in:
Michael Boelen 2023-06-26 11:38:27 +02:00
parent 015369928f
commit 66d170e225

View file

@ -4,70 +4,80 @@
<h2>Aankomende evenementen</h2> <h2>Aankomende evenementen</h2>
{{ $upcoming_events := .Site.Data.evenementen.kalender }} {{ $upcoming_events := .Site.Data.evenementen.kalender }}
{{ $upcoming_events := sort $upcoming_events ".date_start" "asc" }} {{ $upcoming_events := sort $upcoming_events ".date_start" "asc" }}
<div class="three-column-grid">
{{ range first 50 (where $upcoming_events "date_start" "gt" (dateFormat "2006-01-02" now)) }} {{ range first 50 (where $upcoming_events "date_start" "gt" (dateFormat "2006-01-02" now)) }}
<div id="{{ anchorize (.date_start | dateFormat "2006-01-02") }}-{{ anchorize .name }}" style="border: 1px solid darkgray; border-radius: 2px; padding:10px; margin:2px;"> <div id="{{ anchorize (.date_start | dateFormat "2006-01-02") }}-{{ anchorize .name }}">
<h3>{{ .date_start | dateFormat "02-01-2006" }} - {{ .name }}</h3> <h3>{{ .name }}</h3>
{{ with .organizer }}<p><em>Georganiseerd door {{ .}}</em></p>{{ end }} {{ if .organizer }}<small><em>Georganiseerd door {{ .organizer }}</em></small>{{ end }}
{{ with .event_organizer }}<p><em>Georganiseerd door {{ .}}</em></p>{{ end }} {{ if .event_organizer }}<small><em>Georganiseerd door {{ if .event_organizer_url }}<a href="{{ .event_organizer_url }}" rel="nofollow noopener">{{ .event_organizer }}</a>{{ else }}{{ .event_organizer }}{{ end }}</em></small>{{ end }}
{{ if ne .date_start .date_end }} {{ if ne .date_start .date_end }}
<p>Event van meerdere dagen: <time class="g time" datetime="{{ dateFormat "2006-01-02" .date_start }}">{{ .date_start | dateFormat "02-01-2006" }}</time> t/m <time class="g time" datetime="{{ dateFormat "2006-01-02" .date_end }}">{{ .date_end | dateFormat "02-01-2006" }}</time></p> <p>Event van meerdere dagen: <time class="g time" datetime="{{ dateFormat "2006-01-02" .date_start }}">{{ .date_start | time.Format ":date_full" }}</time> t/m <time class="g time" datetime="{{ dateFormat "2006-01-02" .date_end }}">{{ .date_end | time.Format ":date_full" }}</time></p>
{{ end }} {{ else }}
{{ $event_location := .event_location | default "Locatie onbekend" }} <p>Datum: <time class="g time" datetime="{{ dateFormat "2006-01-02" .date_start }}">{{ .date_start | time.Format ":date_full" }}</time></p>
{{ with .event_address }} {{ end }}
<h4>Locatie en adres</h4> {{ $event_location := .event_location | default "Locatie onbekend" }}
<p><strong>{{ $event_location }}</strong><br>{{ with .street_address }}{{ . }}{{ end }}<br>{{ with .postal_code }}{{ . }}{{ end }}{{ with .city }}, {{ . }}{{ end }}{{ with .country }}, {{ . }}{{ end }}</p> {{ with .event_address }}
<a href="https://www.openstreetmap.org/search?query={{ with .street_address }}{{ . | urlquery }}{{ end }},{{ with .postal_code }}{{ . | urlquery }}{{ end }}{{ with .city }},%20{{ . | urlquery }}{{ end }}">{{ partial "show-svg-icon.html" (dict "context" . "icon" "map-location-dot" "title" "Bekijk locatie op OpenStreetMap") }}</a> <h4>Locatie en adres</h4>
{{ end }} <p><strong>{{ $event_location }}</strong><br>{{ with .street_address }}{{ . }}{{ end }}<br>{{ with .postal_code }}{{ . }}{{ end }}{{ with .city }}, {{ . }}{{ end }}{{ with .country }}, {{ . }}{{ end }}</p>
{{ with .link_external }} <a href="https://www.openstreetmap.org/search?query={{ with .street_address }}{{ . | urlquery }}{{ end }},{{ with .postal_code }}{{ . | urlquery }}{{ end }}{{ with .city }},%20{{ . | urlquery }}{{ end }}">{{ partial "show-svg-icon.html" (dict "context" . "icon" "map-location-dot" "title" "Bekijk locatie op OpenStreetMap") }}</a>
<p>&raquo; <a href="{{ . }}" rel="nofollow">Meer informatie (externe link)</a></p> {{ end }}
{{ end }} {{ with .link_external }}
</div> <p>&raquo; <a href="{{ . }}" rel="nofollow">Meer informatie (externe link)</a></p>
{{ end }}
</div>
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "Event", "@type": "Event",
"name": "{{ .name }}", "name": "{{ .name }}",
"startDate": "{{ .date_start | dateFormat "02-01-2006" }}", "startDate": "{{ .date_start | dateFormat "02-01-2006" }}",
"endDate": "{{ .date_end | dateFormat "02-01-2006" }}", "endDate": "{{ .date_end | dateFormat "02-01-2006" }}",
"eventAttendanceMode": "https://schema.org/{{ if .event_attendance_mode }}{{ .event_attendance_mode | strings.FirstUpper }}{{ else }}Offline{{ end }}EventAttendanceMode", "eventAttendanceMode": "https://schema.org/{{ if .event_attendance_mode }}{{ .event_attendance_mode | strings.FirstUpper }}{{ else }}Offline{{ end }}EventAttendanceMode",
"eventStatus": "https://schema.org/EventScheduled", "eventStatus": "https://schema.org/EventScheduled",
{{ with .event_address }} {{ with .event_address }}
"location": { "location": {
"@type": "Place", "@type": "Place",
"address": { "address": {
"@type": "PostalAddress", "@type": "PostalAddress",
{{ with .city }}"addressLocality": "{{ . }}",{{ end }} {{ with .city }}"addressLocality": "{{ . }}",{{ end }}
{{ with .street_address }}"streetAddress": "{{ . }}",{{ end }} {{ with .street_address }}"streetAddress": "{{ . }}",{{ end }}
{{ with .postal_code }}"postalCode": "{{ . }}",{{ end }} {{ with .postal_code }}"postalCode": "{{ . }}",{{ end }}
"addressCountry": "{{ if .country }}{{ .country }}{{ else }}The Netherlands{{ end }}" "addressCountry": "{{ if .country }}{{ .country }}{{ else }}The Netherlands{{ end }}"
} }
}, },
{{ end }} {{ end }}
{{ with .event_image }} {{ if .event_virtual_location }}
"image": [ "location": {
"{{ .url }}" "@type": "VirtualLocation",
], "url": "{{ . }}"
{{ end }} },
"description": "{{ if .event_description }}{{ .event_description }}{{ else }}{{ default .name }}{{ with .event_location}} @ {{ . }}{{ end }}{{ end }}", {{ end }}
{{ if .event_organizer }} {{ with .event_image }}
"performer": { "image": [
"@type": "Organization", "{{ .url }}"
"name": "{{ .event_organizer }}" ],
}, {{ end }}
"organizer": { "description": "{{ if .event_description }}{{ .event_description }}{{ else }}{{ default .name }}{{ with .event_location}} @ {{ . }}{{ end }}{{ end }}",
"@type": "Organization", {{ if .event_organizer }}
"name": "{{ .event_organizer }}", "performer": {
"url": "{{ .event_organizer_url }}" "@type": "Organization",
}, "name": "{{ .event_organizer }}"
{{ end }} },
{{ if .event_url }} "organizer": {
"url": "{{ .event_url }}", "@type": "Organization",
{{ else if .link_external }} "name": "{{ .event_organizer }}",
"url": "{{ .link_external }}", "url": "{{ .event_organizer_url }}"
{{ end }} },
"isAccessibleForFree": {{ if .event_free_access }}true{{ else }}false{{ end }} {{ end }}
} {{ if .event_url }}
</script> "url": "{{ .event_url }}",
{{ else if .link_external }}
"url": "{{ .link_external }}",
{{ end }}
"isAccessibleForFree": {{ if .event_free_access }}true{{ else }}false{{ end }}
}
</script>
{{ end }} {{ end }}
</div>
{{ end }} {{ end }}