Skip to content

Commit 1d71783

Browse files
authored
Merge pull request #267 from neural-loop/main
Event page minor updates
2 parents f184ae7 + a2d410a commit 1d71783

File tree

2 files changed

+85
-37
lines changed

2 files changed

+85
-37
lines changed
Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,62 @@
11
{{ $ctx := .context | default . }}
22
{{ $type := .type | default "general" }}
3-
<ul class="mb-4">
4-
{{ if $ctx.Params.author }}
5-
<li class="mr-4 inline-block">
6-
{{ partial "icon.html" (dict "style" "regular" "name" "circle-user" "class" "mr-2") }}
7-
{{ if eq $type "event" }}
8-
{{ partial "components/author-links.html" $ctx }}
9-
{{ else }}
10-
{{ partial "components/author-links.html" $ctx }}
3+
4+
{{ $hasInfo := or $ctx.Params.author $ctx.Date }}
5+
{{ $hasButtons := false }}
6+
{{ if eq $type "event" }}
7+
{{ $hasButtons = or $ctx.Params.speaker_slides $ctx.Params.speaker_notebook $ctx.Params.speaker_code $ctx.Params.video $ctx.Params.upcoming }}
8+
{{ end }}
9+
10+
{{ if or $hasInfo $hasButtons }}
11+
<div class="metadata-container flex flex-wrap items-center justify-between gap-x-6 gap-y-3 mb-6 py-0">
12+
13+
<!-- Left side: Info (Author, Date) -->
14+
<div class="info-items flex flex-wrap items-center gap-x-5 gap-y-2 text-sm text-gray-600 dark:text-gray-400">
15+
16+
{{ if $ctx.Params.author }}
17+
<div class="author-item flex items-center">
18+
{{ partial "icon.html" (dict "style" "regular" "name" "circle-user" "class" "mr-2") }}
19+
<span>By {{ partial "components/author-links.html" $ctx }}</span>
20+
</div>
1121
{{ end }}
12-
</li>
13-
{{ end }}
14-
{{ if $ctx.Date }}
15-
<li class="mr-4 inline-block">
16-
{{ partial "icon.html" (dict "style" "regular" "name" "clock" "class" "mr-2") }}
17-
{{ $ctx.Date.Format (site.Params.dateFormatSingle | default "January 2, 2006") }}
18-
{{ if eq $type "event" }}
19-
{{ if $ctx.Params.start_time }}
20-
{{ $ctx.Params.start_time }}{{ if $ctx.Params.end_time }} - {{ $ctx.Params.end_time }}{{ end }} {{ $ctx.Params.time_zone }}
21-
{{ end }}
22-
{{ else if ne $ctx.Params.Lastmod $ctx.Params.Date }}
23-
(Updated {{ $ctx.Params.Lastmod.Format (site.Params.dateFormatSingle | default "January 2, 2006") }})
22+
23+
{{ if $ctx.Date }}
24+
<div class="date-item flex items-center">
25+
{{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}
26+
<span>
27+
{{- $ctx.Date.Format (site.Params.dateFormatSingle | default "January 2, 2006") -}}
28+
29+
{{- /* Show time for UPCOMING events */ -}}
30+
{{- if and $ctx.Params.upcoming $ctx.Params.start_time -}}
31+
<span class="mx-1 text-gray-400">·</span>
32+
{{- $ctx.Params.start_time }}{{ if $ctx.Params.end_time }} - {{ $ctx.Params.end_time }}{{ end }} {{ $ctx.Params.time_zone -}}
33+
{{- end -}}
34+
35+
{{- /* Show 'Updated' for non-events (like blog posts) */ -}}
36+
{{- if and (ne $type "event") (ne $ctx.Lastmod $ctx.Date) -}}
37+
<span class="italic text-gray-500 ml-2">(Updated {{ $ctx.Lastmod.Format (site.Params.dateFormatSingle | default "January 2, 2006") }})</span>
38+
{{- end -}}
39+
</span>
40+
</div>
2441
{{ end }}
25-
</li>
26-
{{ end }}
27-
{{ if eq $type "event" }}
28-
<li class="mr-4 inline-block">
29-
{{ $slides := $ctx.Params.speaker_slides }}{{ if $slides }}<a href="{{ $slides }}" target="_blank" class="ms-1 btn btn-new-primary btn-sm">{{ partial "icon.html" (dict "style" "regular" "name" "images" "class" "mr-2") }}Slides</a>{{ end }}
30-
{{ $notebook := $ctx.Params.speaker_notebook }}{{ if $notebook }}<a href="{{ $notebook }}" target="_blank" class="ms-1 btn btn-new-primary btn-sm">{{ partial "icon.html" (dict "style" "regular" "name" "folder" "class" "mr-2") }}Notebook</a>{{ end }}
31-
{{ $code := $ctx.Params.speaker_code }}{{ if $code }}<a href="{{ $code }}" target="_blank" class="ms-1 btn btn-new-primary btn-sm">{{ partial "icon.html" (dict "style" "brands" "name" "github" "class" "mr-2") }}Code</a>{{ end }}
32-
{{ if $ctx.Params.upcoming }}{{ if $ctx.Params.upcoming_url }}<a href="{{ $ctx.Params.upcoming_url }}" target="_blank" class="ms-1 btn btn-new-primary btn-sm">{{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}Event</a>{{ else }}<a href="https://www.youtube.com/@openneuromorphic" target="_blank" class="ms-1 btn btn-new-primary btn-sm">{{ partial "icon.html" (dict "style" "brands" "name" "youtube" "class" "mr-2") }}Event</a>{{ end }}{{ end }}
33-
</li>
42+
43+
</div>
44+
45+
<!-- Right side: Action Buttons -->
46+
{{ if $hasButtons }}
47+
<div class="action-buttons flex flex-wrap gap-2">
48+
{{ with $ctx.Params.speaker_slides }}<a href="{{ . }}" target="_blank" rel="noopener" class="btn btn-sm btn-outline-primary">{{ partial "icon.html" (dict "style" "regular" "name" "images" "class" "mr-1.5") }}Slides</a>{{ end }}
49+
{{ with $ctx.Params.speaker_notebook }}<a href="{{ . }}" target="_blank" rel="noopener" class="btn btn-sm btn-outline-primary">{{ partial "icon.html" (dict "style" "regular" "name" "folder" "class" "mr-1.5") }}Notebook</a>{{ end }}
50+
{{ with $ctx.Params.speaker_code }}<a href="{{ . }}" target="_blank" rel="noopener" class="btn btn-sm btn-outline-primary">{{ partial "icon.html" (dict "style" "brands" "name" "github" "class" "mr-1.5") }}Code</a>{{ end }}
51+
52+
{{ if $ctx.Params.upcoming }}
53+
{{ $event_url := $ctx.Params.upcoming_url | default "https://www.youtube.com/@openneuromorphic" }}
54+
<a href="{{ $event_url }}" target="_blank" rel="noopener" class="btn btn-sm btn-new-primary">{{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-1.5") }}Event Link</a>
55+
{{ else if $ctx.Params.video }}
56+
<a href="https://www.youtube.com/watch?v={{ $ctx.Params.video }}" target="_blank" rel="noopener" class="btn btn-sm btn-new-primary">{{ partial "icon.html" (dict "style" "brands" "name" "youtube" "class" "mr-1.5") }}Watch on YouTube</a>
57+
{{ end }}
58+
</div>
3459
{{ end }}
35-
</ul>
60+
61+
</div>
62+
{{ end }}

layouts/partials/youtube-lite.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
1-
{{ $videoid:= .Id }}
2-
{{ $class:= .Class }}
3-
{{ $style:= .Style }}
4-
{{ $width:= .Width }}
5-
{{ $attr:= .Attr }}
1+
{{- $videoid:= .Id -}}
2+
{{- $class:= .Class -}}
3+
{{- $style:= .Style -}}
4+
{{- $width:= .Width -}}
5+
{{- $attr:= .Attr -}}
6+
7+
<style>
8+
youtube-lite > noscript {
9+
display: none;
10+
}
11+
</style>
612

713
<div
814
{{ with $class }}class="{{ . }}"{{ end }}
915
style="overflow: hidden;{{ with $width }} width:{{ .| safeCSS }};
1016
{{ end }}{{ with $style }}{{ .| safeCSS }}{{ end }}">
1117
<youtube-lite
1218
videoid="{{ $videoid }}"
13-
{{ with $attr }}{{ . | safeHTMLAttr }}{{ end }}></youtube-lite>
14-
</div>
19+
{{ with $attr }}{{ . | safeHTMLAttr }}{{ end }}>
20+
<noscript>
21+
<a href="https://www.youtube.com/watch?v={{ $videoid }}" target="_blank" rel="noopener" style="display: block; position: relative; cursor: pointer; text-decoration: none; color: inherit;">
22+
<img
23+
src="https://i.ytimg.com/vi/{{ $videoid }}/hqdefault.jpg"
24+
alt="Video thumbnail for {{ $videoid }}"
25+
style="width: 100%; height: auto; border-radius: 8px;"
26+
loading="lazy"
27+
/>
28+
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 68px; height: 48px; pointer-events: none;">
29+
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00" fill-opacity="0.8"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg>
30+
</div>
31+
<p style="text-align:center; margin-top: 0.5rem; font-weight: 500;">Watch on YouTube (JavaScript is disabled)</p>
32+
</a>
33+
</noscript>
34+
</youtube-lite>
35+
</div>

0 commit comments

Comments
 (0)