Skip to content

Commit 50916b5

Browse files
committed
refactor(layouts): Simplify thumbnail logic
Removed OG image prioritization. Now uses front matter 'image' param or default.
1 parent e486aa8 commit 50916b5

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

layouts/index.html

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,11 @@ <h2 class="section-title">What's New at ONM</h2>
5050
<h3 class="text-2xl font-bold mb-6 text-center lg:text-left text-text dark:text-darkmode-text">Recent Event</h3>
5151
<div class="event-card-simple bg-white dark:bg-darkmode-theme-light rounded-xl p-4 shadow-md hover:shadow-lg transition-all duration-300 ease-in-out mb-8">
5252

53-
{{/* --- START: NEW Thumbnail Logic to prioritize OG image --- */}}
53+
{{/* Thumbnail Logic */}}
54+
{{ $image_param := .Params.image }}
5455
{{ $img_resource := "" }}
5556
{{ $processed_img := "" }}
5657

57-
{{/* 1. Try to find the 16x9 OG image first */}}
58-
{{ $slug := "" }}
59-
{{ if .File }}{{ $slug = path.Base .File.Dir }}{{ end }}
60-
{{ if $slug }}
61-
{{ $ogImageName := printf "%s-og-16x9.jpg" $slug }}
62-
{{ $img_resource = .Resources.GetMatch $ogImageName }}
63-
{{ end }}
64-
65-
{{/* 2. If OG image not found, fall back to the front matter 'image' param */}}
66-
{{ if not $img_resource }}
67-
{{ $image_param := .Params.image }}
6858
{{ if $image_param }}
6959
{{ $img_resource = .Resources.GetMatch $image_param }}
7060
{{ if not $img_resource }}
@@ -77,14 +67,11 @@ <h3 class="text-2xl font-bold mb-6 text-center lg:text-left text-text dark:text-
7767
{{ end }}
7868
{{ end }}
7969
{{ end }}
80-
{{ end }}
8170

82-
{{/* 3. If still no image, use the default */}}
8371
{{ if not $img_resource }}
8472
{{ $img_resource = resources.Get "images/workshop-thumbnail-default.png" }}
8573
{{ end }}
8674

87-
{{/* 4. Process the final image resource */}}
8875
{{ if $img_resource }}
8976
{{ $processed_img = $img_resource.Fill "504x280 Lanczos" }}
9077
{{ end }}
@@ -94,7 +81,6 @@ <h3 class="text-2xl font-bold mb-6 text-center lg:text-left text-text dark:text-
9481
<img src="{{ $processed_img.RelPermalink }}" alt="{{ .Title }}" class="w-full rounded object-cover">
9582
</a>
9683
{{ end }}
97-
{{/* --- END: NEW Thumbnail Logic --- */}}
9884

9985
<div>
10086
<span class="date-badge mb-1 inline-block text-xs">{{ .Date.Format "Jan 02, 2006" }}</span>

0 commit comments

Comments
 (0)