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

View File

@@ -4,7 +4,7 @@
{{- $img = resources.Get $path -}} {{- $img = resources.Get $path -}}
{{- end -}} {{- end -}}
{{- with $img -}} {{- 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 -}} {{- else -}}
<img alt="{{ $.Text }}" src="{{ $.Destination | safeURL }}" /> <img alt="{{ $.Text }}" src="{{ $.Destination | safeURL }}" loading="lazy" />
{{- end -}} {{- end -}}