blob: 5dcfa808f6cf9985409d4b0f243207da859e33b3 (
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
48
49
50
51
52
53
54
55
56
|
{{- $source := $.Destination | safeURL -}}
{{- $local := print "content/" $source -}}
{{- $remoteImage := resources.GetRemote $source -}}
{{- $dimensions := "600x" -}}
{{- $width := "" -}}
{{- $height := "" -}}
{{- $sourceFit := "" -}}
{{- with $remoteImage -}}
{{- with .Err -}}
{{- if fileExists $local -}}
{{- $localImage := imageConfig $local -}}
{{- with $localImage -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- end -}}
{{ $source = print ("" | absURL) $source }}
{{- else -}}
{{- $source = print "/images/404.png" -}}
{{- $404image := imageConfig (print "static/" $source) -}}
{{- with $404image -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- end -}}
{{ $source = print ("" | absURL) $source }}
{{- end -}}
{{- else -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- $sourceFit = (.Resize $dimensions).Permalink -}}
{{ end }}
{{ end }}
{{- /* This comment removes trailing newlines and white spaces. */ -}}
<figure>
<a href="{{ $source }}">
<img loading="lazy"
src="{{ or $sourceFit $source }}"
alt="{{ $.Text | htmlUnescape }}"
title="{{ $.Text | htmlUnescape }}"
width="{{ $width }}"
height="{{ $height }}"
/>
</a>
<figcaption>
{{ with $.Title -}}
{{ . | markdownify }}
{{ else -}}
Image/Picture
{{ end -}}
<br>
{{ with $sourceFit }} Cache: {{ print "[Link](" . ")" | markdownify }} · {{ end }}
Source: {{ print "[Link](" $source ")" | markdownify }}
</figcaption>
</figure>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
|