Skip to content

Commit 4886bdc

Browse files
committed
Refactor: Update sidebars to display upcoming events
This commit refactors the workshop and student talk sidebars to display upcoming events. The hacking hours sidebar has also been updated with minor formatting changes. The old upcoming events component was removed.
1 parent 943c17d commit 4886bdc

File tree

1 file changed

+50
-43
lines changed

1 file changed

+50
-43
lines changed

layouts/partials/structured-markup/event.html

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,78 @@
22
{{ $defaultOgImage := site.Params.metadata.image | default "images/og-image.png" | absLangURL }}
33
{{ $eventStartDate := "" }}{{ $eventEndDate := "" }}
44
{{ if $page_context.Params.start_time }}
5-
{{ $eventStartDate = printf "%sT%s" ($page_context.Date.Format "2006-01-02") $page_context.Params.start_time }}
5+
{{ $eventStartDate = printf "%sT%s" ($page_context.Date.Format "2006-01-02") $page_context.Params.start_time }}
66
{{ else }}
7-
{{ $eventStartDate = $page_context.Date.Format "2006-01-02T00:00:00" }}
7+
{{ $eventStartDate = $page_context.Date.Format "2006-01-02T00:00:00" }}
88
{{ end }}
99
{{ if $page_context.Params.end_time }}
10-
{{ $eventEndDate = printf "%sT%s" ($page_context.Date.Format "2006-01-02") $page_context.Params.end_time }}
10+
{{ $eventEndDate = printf "%sT%s" ($page_context.Date.Format "2006-01-02") $page_context.Params.end_time }}
1111
{{ else }}
12-
{{ $eventEndDate = $eventStartDate }}
12+
{{ $eventEndDate = $eventStartDate }}
1313
{{ end }}
1414

1515
{{ $offset := "" }}
1616
{{ with $page_context.Params.time_zone }}
17-
{{ if eq . "CET" }}{{ $offset = "+01:00" }}{{ else if eq . "CEST" }}{{ $offset = "+02:00" }}{{ else }}{{ $offset = "Z" }}{{ end }}
17+
{{ if eq . "CET" }}{{ $offset = "+01:00" }}{{ else if eq . "CEST" }}{{ $offset = "+02:00" }}{{ else }}{{ $offset = "Z" }}{{ end }}
1818
{{ else }}
19-
{{ $offset = "Z" }}
19+
{{ $offset = "Z" }}
2020
{{ end }}
2121

2222
{{ $imagePath := $page_context.Params.image }}
2323
{{ $resolvedImageURL := "" }}
2424
{{ if $imagePath }}
25-
{{ if hasPrefix $imagePath "/" }}
26-
{{ $resolvedImageURL = $imagePath | absLangURL }}
27-
{{ else }}
28-
{{ with $page_context.Resources.GetMatch $imagePath }}
29-
{{ $resolvedImageURL = .Permalink }}
30-
{{ else }}
31-
{{ $resolvedImageURL = printf "%s%s" $page_context.RelPermalink $imagePath | absLangURL }}
32-
{{ end }}
33-
{{ end }}
25+
{{ if hasPrefix $imagePath "/" }}
26+
{{ $resolvedImageURL = $imagePath | absLangURL }}
3427
{{ else }}
35-
{{ $resolvedImageURL = $defaultOgImage }}
28+
{{ with $page_context.Resources.GetMatch $imagePath }}
29+
{{ $resolvedImageURL = .Permalink }}
30+
{{ else }}
31+
{{ $resolvedImageURL = printf "%s%s" $page_context.RelPermalink $imagePath | absLangURL }}
32+
{{ end }}
33+
{{ end }}
34+
{{ else }}
35+
{{ $resolvedImageURL = $defaultOgImage }}
3636
{{ end }}
3737

3838
{{ $eventLD := dict
39-
"@context" "https://schema.org"
40-
"@type" "Event"
41-
"name" $page_context.Params.Title
42-
"startDate" (printf "%s%s" $eventStartDate $offset)
43-
"endDate" (printf "%s%s" $eventEndDate $offset)
44-
"eventStatus" "https://schema.org/EventScheduled"
45-
"eventAttendanceMode" "https://schema.org/OnlineEventAttendanceMode"
46-
"location" (dict "@type" "VirtualLocation" "url" "https://youtube.com/@openneuromorphic")
47-
"image" (slice $resolvedImageURL)
48-
"description" $page_context.Params.Description
49-
"offers" (dict "@type" "Offer" "price" "0" "availability" "https://schema.org/InStock")
39+
"@context" "https://schema.org"
40+
"@type" "Event"
41+
"name" $page_context.Params.Title
42+
"startDate" (printf "%s%s" $eventStartDate $offset)
43+
"endDate" (printf "%s%s" $eventEndDate $offset)
44+
"eventStatus" "https://schema.org/EventScheduled"
45+
"eventAttendanceMode" "https://schema.org/OnlineEventAttendanceMode"
46+
"location" (dict "@type" "VirtualLocation" "url" "https://youtube.com/@openneuromorphic")
47+
"image" (slice $resolvedImageURL)
48+
"description" $page_context.Params.Description
49+
"offers" (dict
50+
"@type" "Offer"
51+
"price" "0"
52+
"priceCurrency" "USD"
53+
"availability" "https://schema.org/InStock"
54+
"url" ($page_context.Permalink | absLangURL)
55+
"validFrom" ($page_context.Date.Format "2006-01-02T15:04:05Z07:00")
56+
)
5057
}}
5158
{{ if $page_context.Params.author }}
52-
{{ $authorList := slice }}
53-
{{ with $page_context.Params.author }}{{ if reflect.IsSlice . }}{{ $authorList = . }}{{ else }}{{ $authorList = slice . }}{{ end }}{{ end }}
59+
{{ $authorList := slice }}
60+
{{ with $page_context.Params.author }}{{ if reflect.IsSlice . }}{{ $authorList = . }}{{ else }}{{ $authorList = slice . }}{{ end }}{{ end }}
5461

55-
{{ $performers := slice }}
56-
{{ range $authorList }}
57-
{{ $authorName := . }}
58-
{{ $nameForProcessing := $authorName | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }}
59-
{{ $contributorSlug := $nameForProcessing | anchorize }}
60-
{{ $contributorPage := site.GetPage (printf "contributors/%s" $contributorSlug) }}
62+
{{ $performers := slice }}
63+
{{ range $authorList }}
64+
{{ $authorName := . }}
65+
{{ $nameForProcessing := $authorName | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }}
66+
{{ $contributorSlug := $nameForProcessing | anchorize }}
67+
{{ $contributorPage := site.GetPage (printf "contributors/%s" $contributorSlug) }}
6168

62-
{{ $personDict := dict "@type" "Person" "name" $authorName }}
63-
{{ if $contributorPage }}
64-
{{ $personDict = merge $personDict (dict "url" ($contributorPage.Permalink | absLangURL)) }}
65-
{{ end }}
66-
{{ $performers = $performers | append $personDict }}
67-
{{ end }}
68-
{{ $eventLD = merge $eventLD (dict "performer" $performers) }}
69+
{{ $personDict := dict "@type" "Person" "name" $authorName }}
70+
{{ if $contributorPage }}
71+
{{ $personDict = merge $personDict (dict "url" ($contributorPage.Permalink | absLangURL)) }}
72+
{{ end }}
73+
{{ $performers = $performers | append $personDict }}
74+
{{ end }}
75+
{{ $eventLD = merge $eventLD (dict "performer" $performers) }}
6976
{{ end }}
7077
{{ $eventLD = merge $eventLD (dict "organizer" (dict "@type" "Organization" "name" "Open Neuromorphic" "url" (absLangURL "/"))) }}
7178

72-
{{ return $eventLD }}
79+
{{ return $eventLD }}

0 commit comments

Comments
 (0)