Lazy load markdown images to improve mobile experience

This commit is contained in:
quest 2022-09-14 01:01:16 -10:00
parent 89a5bc6c96
commit 61a560d90b
No known key found for this signature in database
GPG Key ID: E49B7E0000228DDD

View File

@ -4,7 +4,7 @@
{{- $img = resources.Get $path -}}
{{- end -}}
{{- with $img -}}
<img alt="{{ $.Text }}" src="{{ $img.RelPermalink }}" width={{ $img.Width }} height={{ $img.Height }} />
<img alt="{{ $.Text }}" src="{{ $img.RelPermalink }}" width={{ $img.Width }} height={{ $img.Height }} loading="lazy" />
{{- else -}}
<img alt="{{ $.Text }}" src="{{ $.Destination | safeURL }}" />
<img alt="{{ $.Text }}" src="{{ $.Destination | safeURL }}" loading="lazy" />
{{- end -}}