27 lines
989 B
HTML
27 lines
989 B
HTML
{{- $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 -}}
|
|
<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 -}}
|