blob: fd83d75be75d422dc1b30c643f84e3903f87278e (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
{{- $source := $.Destination | safeURL -}}
{{- $local := print "content/" $source -}}
{{- $remoteImage := resources.GetRemote $source -}}
{{- $width := "" -}}
{{- $height := "" -}}
{{- with $remoteImage -}}
{{- with .Err -}}
{{- if fileExists $local -}}
{{- $404image := imageConfig $local -}}
{{- with $404image -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- end -}}
{{ $source = print ("" | absURL) $source }}
{{- else -}}
{{- $source = print "/images/404.png" -}}
{{- $local = print "static/" $source -}}
{{- $404image := imageConfig $local -}}
{{- with $404image -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- end -}}
{{ $source = print ("" | absURL) $source }}
{{- end -}}
{{- else -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{ end }}
{{ end }}
{{- /* This comment removes trailing newlines and white spaces. */ -}}
<figure>
<a href="{{ $source }}">
<img loading="lazy"
src="{{ $source }}"
alt="{{ $.Text | htmlUnescape }}"
title="{{ $.Text | htmlUnescape }}"
width="{{ $width }}"
height="{{ $height }}"
/>
</a>
{{ if $.Title }}
<figcaption>{{ $.Title | markdownify }}</figcaption>
{{ end -}}
</figure>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
|