|
4 | 4 | {{ $default_image_path := .default_image_path | default "images/workshop-thumbnail-default.png" }} |
5 | 5 |
|
6 | 6 | {{ $image_param := $ctx.Params.image }} |
| 7 | + |
| 8 | +{{/* Fallback: Check for generated OG image in bundle if explicit image is missing */}} |
| 9 | +{{ if not $image_param }} |
| 10 | +{{ if $ctx.File }} |
| 11 | +{{ $pageSlug := path.Base $ctx.File.Dir }} |
| 12 | +{{ $ogImageName := printf "%s-og-16x9.jpg" $pageSlug }} |
| 13 | +{{ with $ctx.Resources.GetMatch $ogImageName }} |
| 14 | +{{ $image_param = .Name }} |
| 15 | +{{ end }} |
| 16 | +{{ end }} |
| 17 | +{{ end }} |
| 18 | + |
7 | 19 | {{ $video_id := $ctx.Params.video }} |
8 | 20 |
|
9 | 21 | {{ $base_class := "event-card" }} |
10 | 22 | {{ $variant_class := printf "%s--%s" $base_class $variant }} |
11 | 23 |
|
12 | 24 | <div class="{{ $base_class }} {{ $variant_class }} {{ if eq $variant "wide" }}row{{ end }}"> |
13 | | - {{/* Media Column */}} |
14 | | - <div class="{{ if eq $variant "wide" }}lg:col-4 md:col-12{{ end }} {{ $base_class }}__media-container"> |
| 25 | +{{/* Media Column */}} |
| 26 | +<div class="{{ if eq $variant "wide" }}lg:col-4 md:col-12{{ end }} {{ $base_class }}__media-container"> |
15 | 27 |
|
16 | | - {{ if and (eq $variant "featured") $video_id }} |
17 | | - <div class="mb-4 rounded"> |
18 | | - {{ partial "youtube-lite.html" (dict "Id" $video_id) }} |
19 | | - </div> |
20 | | - {{ else if $image_param }} |
21 | | - <a href="{{ $ctx.RelPermalink }}" class="{{ $base_class }}__image-link relative block group"> |
22 | | - {{ partial "image" (dict "Src" $image_param "Context" $ctx "Alt" $ctx.Title "Class" (printf "%s__image" $base_class) "Size" $image_size) }} |
23 | | - {{ if $video_id }} |
24 | | - {{ partial "components/video-play-overlay.html" (dict "rounding_class" "rounded") }} |
25 | | - {{ end }} |
26 | | - </a> |
27 | | - {{ else }} |
28 | | - <a href="{{ $ctx.RelPermalink }}" class="{{ $base_class }}__image-link relative block group"> |
29 | | - {{ partial "image" (dict "Src" $default_image_path "Alt" $ctx.Title "Class" (printf "%s__image %s__image--default" $base_class $base_class) "Size" $image_size) }} |
30 | | - {{ if $video_id }} |
31 | | - {{ partial "components/video-play-overlay.html" (dict "rounding_class" "rounded") }} |
32 | | - {{ end }} |
33 | | - </a> |
34 | | - {{ end }} |
35 | | - </div> |
| 28 | +{{ if and (eq $variant "featured") $video_id }} |
| 29 | +<div class="mb-4 rounded"> |
| 30 | + {{ partial "youtube-lite.html" (dict "Id" $video_id) }} |
| 31 | +</div> |
| 32 | +{{ else if $image_param }} |
| 33 | +<a href="{{ $ctx.RelPermalink }}" class="{{ $base_class }}__image-link relative block group"> |
| 34 | + {{ partial "image" (dict "Src" $image_param "Context" $ctx "Alt" $ctx.Title "Class" (printf "%s__image" $base_class) "Size" $image_size) }} |
| 35 | + {{ if $video_id }} |
| 36 | + {{ partial "components/video-play-overlay.html" (dict "rounding_class" "rounded") }} |
| 37 | + {{ end }} |
| 38 | +</a> |
| 39 | +{{ else }} |
| 40 | +<a href="{{ $ctx.RelPermalink }}" class="{{ $base_class }}__image-link relative block group"> |
| 41 | + {{ partial "image" (dict "Src" $default_image_path "Alt" $ctx.Title "Class" (printf "%s__image %s__image--default" $base_class $base_class) "Size" $image_size) }} |
| 42 | + {{ if $video_id }} |
| 43 | + {{ partial "components/video-play-overlay.html" (dict "rounding_class" "rounded") }} |
| 44 | + {{ end }} |
| 45 | +</a> |
| 46 | +{{ end }} |
| 47 | +</div> |
36 | 48 |
|
37 | | - {{/* Content Column */}} |
38 | | - <div class="{{ if eq $variant "wide" }}lg:col-8 md:col-12{{ end }} {{ $base_class }}__content-container"> |
39 | | - <h4 class="{{ $base_class }}__title {{ if eq $variant "wide" }}mb-3 md:pt-4 lg:pt-0{{ else }}mb-3{{ end }}"> |
40 | | - <a href="{{ $ctx.RelPermalink }}">{{ $ctx.Title }}</a> |
41 | | - </h4> |
42 | | - <ul class="{{ $base_class }}__meta-list"> |
43 | | - <li class="{{ $base_class }}__meta-item inline-flex items-center"> |
44 | | - {{ partial "icon.html" (dict "style" "regular" "name" "circle-user" "class" "mr-2") }}{{ partial "components/author-links.html" $ctx }} |
45 | | - </li> |
46 | | - {{ if $ctx.Date }} |
47 | | - <li class="{{ $base_class }}__meta-item inline-flex items-center"> |
48 | | - {{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}{{ $ctx.Date.Format "January 2, 2006" }} |
49 | | - </li> |
50 | | - {{ end }} |
51 | | - {{ if $ctx.Params.upcoming }} |
52 | | - <li class="{{ $base_class }}__meta-item inline-flex items-center"> |
53 | | - {{ partial "icon.html" (dict "style" "regular" "name" "clock" "class" "mr-2") }}{{ $ctx.Params.start_time }} - {{ $ctx.Params.end_time }} {{ $ctx.Params.time_zone }} |
54 | | - </li> |
55 | | - {{ end }} |
56 | | - </ul> |
57 | | - <p class="{{ $base_class }}__description {{ if eq $variant "wide" }}mb-2{{ else }}mb-6{{ end }}">{{ $ctx.Description }}</p> |
58 | | - </div> |
| 49 | +{{/* Content Column */}} |
| 50 | +<div class="{{ if eq $variant "wide" }}lg:col-8 md:col-12{{ end }} {{ $base_class }}__content-container"> |
| 51 | +<h4 class="{{ $base_class }}__title {{ if eq $variant "wide" }}mb-3 md:pt-4 lg:pt-0{{ else }}mb-3{{ end }}"> |
| 52 | +<a href="{{ $ctx.RelPermalink }}">{{ $ctx.Title }}</a> |
| 53 | +</h4> |
| 54 | +<ul class="{{ $base_class }}__meta-list"> |
| 55 | + <li class="{{ $base_class }}__meta-item inline-flex items-center"> |
| 56 | + {{ partial "icon.html" (dict "style" "regular" "name" "circle-user" "class" "mr-2") }}{{ partial "components/author-links.html" $ctx }} |
| 57 | + </li> |
| 58 | + {{ if $ctx.Date }} |
| 59 | + <li class="{{ $base_class }}__meta-item inline-flex items-center"> |
| 60 | + {{ partial "icon.html" (dict "style" "regular" "name" "calendar" "class" "mr-2") }}{{ $ctx.Date.Format "January 2, 2006" }} |
| 61 | + </li> |
| 62 | + {{ end }} |
| 63 | + {{ if $ctx.Params.upcoming }} |
| 64 | + <li class="{{ $base_class }}__meta-item inline-flex items-center"> |
| 65 | + {{ partial "icon.html" (dict "style" "regular" "name" "clock" "class" "mr-2") }}{{ $ctx.Params.start_time }} - {{ $ctx.Params.end_time }} {{ $ctx.Params.time_zone }} |
| 66 | + </li> |
| 67 | + {{ end }} |
| 68 | +</ul> |
| 69 | +<p class="{{ $base_class }}__description {{ if eq $variant "wide" }}mb-2{{ else }}mb-6{{ end }}">{{ $ctx.Description }}</p> |
| 70 | +</div> |
59 | 71 | </div> |
0 commit comments