blob: 8f592f9769f91cb411486a62ea93a2b92d3d4dd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
{{- $imageFile := print "public/images/thumbnails/" (partial "article-image.html" .) ".png" -}}
{{- if fileExists $imageFile -}}
{{- $image := imageConfig $imageFile -}}
<a title="{{ .Title }}" href="{{ .Permalink }}">
<picture>
<source srcset="/images/thumbnails/{{ partial "article-image.html" . }}.png" type="image/png">
<source srcset="/images/thumbnails/{{ partial "article-image.html" . }}.jpg" type="image/jpeg">
<source srcset="/images/thumbnails/{{ partial "article-image.html" . }}.webp" type="image/webp">
<img
alt="{{ .Title }}"
src="/images/thumbnails/{{ partial "article-image.html" . }}.png"
width="{{ $image.Width }}"
height="{{ $image.Height }}"
/>
</picture>
</a>
{{- else -}}
{{- $image := imageConfig "public/images/thumbnails/placeholder.png" -}}
<a href="{{ .Permalink }}">
<img
alt="{{ .Title }}"
src="/images/thumbnails/placeholder.png"
height="{{ $image.Height }}"
width="{{ $image.Width }}"
/>
</a>
{{- end -}}
|