Skip to content

Commit 6339fc7

Browse files
authored
Merge pull request open-neuromorphic#388 from neural-loop/endorsement-image
feat(endorsements): Use contributor page image if available
2 parents 9f02e61 + 0b84df3 commit 6339fc7

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

layouts/partials/components/endorsements.html

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,38 @@ <h3 class="text-3xl font-bold text-center mb-10 text-dark dark:text-darkmode-dar
1515
<!-- Left side: Author Info -->
1616
<div class="flex-shrink-0 w-full md:w-1/4">
1717
<div class="flex items-center md:flex-col md:items-start">
18-
{{ if .image }}
19-
<img src="{{ .image }}" alt="Photo of {{ .name }}" class="w-20 h-20 rounded-full object-cover bg-gray-200 mb-0 md:mb-4 mr-4 md:mr-0 flex-shrink-0">
20-
{{ end }}
21-
<div class="text-left">
22-
<p class="font-bold text-dark dark:text-darkmode-dark leading-tight">{{ .name }}</p>
23-
<p class="text-sm text-gray-600 dark:text-gray-400 leading-tight">{{ .title }}</p>
24-
</div>
18+
{{/* --- MODIFICATION START --- */}}
19+
{{ $nameForProcessing := $endorsement.name | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }}
20+
{{ $contributor_slug := $nameForProcessing | anchorize }}
21+
{{ $contributorPage := site.GetPage (printf "contributors/%s" $contributor_slug) }}
22+
23+
{{ $image_found := false }}
24+
{{ if and $contributorPage $contributorPage.Params.image }}
25+
{{ with $contributorPage.Resources.GetMatch $contributorPage.Params.image }}
26+
{{ $thumb := .Fill "160x160 Lanczos" }}
27+
<img src="{{ $thumb.RelPermalink }}" alt="Photo of {{ $endorsement.name }}" class="w-20 h-20 rounded-full object-cover bg-gray-200 mb-0 md:mb-4 mr-4 md:mr-0 flex-shrink-0" width="80" height="80">
28+
{{ $image_found = true }}
29+
{{ end }}
30+
{{ end }}
31+
32+
{{ if not $image_found }}
33+
<div class="w-20 h-20 rounded-full bg-gray-200 dark:bg-darkmode-theme-dark flex items-center justify-center text-xs text-center text-gray-500 mb-0 md:mb-4 mr-4 md:mr-0 flex-shrink-0">
34+
Photo
35+
</div>
36+
{{ end }}
37+
{{/* --- MODIFICATION END --- */}}
38+
<div class="text-left">
39+
<p class="font-bold text-dark dark:text-darkmode-dark leading-tight">{{ $endorsement.name }}</p>
40+
<p class="text-sm text-gray-600 dark:text-gray-400 leading-tight">{{ $endorsement.title }}</p>
41+
</div>
2542
</div>
2643
</div>
2744

2845
<!-- Right side: Quote -->
2946
<div class="text-text dark:text-darkmode-text text-lg italic flex-grow relative border-t md:border-t-0 md:border-l border-border dark:border-darkmode-border pt-6 md:pt-0 md:pl-6">
3047
<span class="absolute -top-4 md:top-0 -left-1 md:-left-7 text-6xl font-serif text-gray-300 dark:text-gray-700 opacity-75">&ldquo;</span>
3148
<p class="pl-2">
32-
{{ .quote | markdownify | chomp }}
49+
{{ $endorsement.quote | markdownify | chomp }}
3350
</p>
3451
</div>
3552
</div>

0 commit comments

Comments
 (0)