@@ -25,16 +25,36 @@ <h1 class="resources-section-title">{{ .Title }}</h1>
2525 {{ if .Pages }}
2626 < div class ="resources-list-grid ">
2727 {{ range .Pages.ByTitle }}
28- {{ if .Params.link }}
2928 {{ $format := .Params.format }}
30- < div class ="resource-card "
29+ {{ $pageTitle := .Title }}
30+ {{ $isPerson := in .Params.subcategories "People" }}
31+ {{ $pageRes := .Resources }}
32+ {{ $imgRes := "" }}
33+ {{ with .Params.images }}
34+ {{ $imgFile := index . 0 }}
35+ {{ $imgRes = $pageRes.Get $imgFile }}
36+ {{ if not $imgRes }}{{ $imgRes = resources.Get (strings.TrimPrefix "/" $imgFile) }}{{ end }}
37+ {{ end }}
38+ < div class ="resource-card{{ if or $imgRes $isPerson }} resource-card--has-image{{ end }} "
3139 data-title ="{{ .Title }} "
3240 data-description ="{{ .Description }} "
3341 data-link ="{{ .Params.link }} "
3442 data-date ="{{ with .Date }}{{ if not .IsZero }}{{ .Format "Jan 2006 " }}{{ end }}{{ end }}"
3543 data-format="{{ .Params.format }} "
3644 data-location ="{{ $loc := slice }}{{ with .Params.city }}{{ $loc = $loc | append . }}{{ end }}{{ range .Params.countries }}{{ $loc = $loc | append . }}{{ end }}{{ delimit $loc ", " }}"
3745 >
46+ {{ if $imgRes }}
47+ {{ $thumb := $imgRes.Fit "320x480 jpg" }}
48+ < a href ="{{ .RelPermalink }} " class ="resource-card-image-wrap resource-card-image-wrap--portrait ">
49+ < img src ="{{ $thumb.RelPermalink }} " alt ="{{ $pageTitle }} " class ="resource-card-image " loading ="lazy " width ="{{ $thumb.Width }} " height ="{{ $thumb.Height }} ">
50+ </ a >
51+ {{ else if $isPerson }}
52+ {{ $initials := "" }}
53+ {{ range split $pageTitle " " }}{{ $initials = printf "%s%s" $initials (substr . 0 1) }}{{ end }}
54+ < a href ="{{ .RelPermalink }} " class ="resource-card-image-wrap resource-card-image-wrap--portrait ">
55+ < div class ="resource-card-image resource-card-image--placeholder " aria-hidden ="true "> {{ $initials }}</ div >
56+ </ a >
57+ {{ end }}
3858 < div class ="resource-card-body ">
3959 < h2 class ="resource-card-title "> {{ .Title }}</ h2 >
4060 {{ with .Description }}< p class ="resource-card-desc "> {{ . }}</ p > {{ end }}
@@ -63,7 +83,6 @@ <h2 class="resource-card-title">{{ .Title }}</h2>
6383 </ div >
6484 </ div >
6585 {{ end }}
66- {{ end }}
6786 </ div >
6887 {{ else }}
6988 < div class ="empty-state ">
0 commit comments