blob: 9bf57a96976f175b9e1609994213d64e552d5b42 (
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
|
{{- $url := urls.Parse .Destination -}}
{{- if $url.Scheme -}}
{{/* third party image */}}
<img loading="lazy" src="{{ .Destination | safeURL }}" alt="{{ $.Text }}" {{ with $.Title}} title="{{ . }}" {{ end }} />
{{- else -}}
{{/* internal image */}}
{{- $img := .Page.Resources.GetMatch .Destination -}}
{{- if not $img -}}
{{- $img = resources.Get .Destination -}}
{{- end -}}
{{- if $img -}}
{{- if eq $img.MediaType.MainType "video" -}}
<figure>
<video class="video-shortcode" preload="metadata" controls>
<source src="{{ $img.RelPermalink }}">
There should have been a video here but your browser does not seem to support it.
</video>
</figure>
{{- else -}}
{{ if (and (not (eq $img.MediaType.SubType "svg")) (gt $img.Height 800)) }}
{{ $img = $img.Resize "200x" }}
{{ end }}
<img loading="lazy" src="{{ $img.RelPermalink }}" type="" alt="{{ $.Text }}" {{ with $.Title}} title="{{ . }}" {{ end }} />
{{- end -}}
{{- else -}}
{{- warnf "No image found for %s from %s" .Destination .Page.File }}
{{- end -}}
{{- end -}}
|