Lazy load images

This commit is contained in:
BBaoVanC 2023-11-05 00:56:13 -05:00
parent f33492ef8e
commit 6c42ae9518
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@
{{ with index . "src" }}
{{ $media := . }}
{{ if eq .MediaType.MainType "image" }}
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" loading="lazy" />
{{ else if eq .MediaType.MainType "video" }}
<video controls preload="metadata">
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">

View File

@ -10,7 +10,7 @@
{{ end }}
{{ if eq $type "image" }}
<img src="{{ $src }}" alt="{{ $alt }}" />
<img src="{{ $src }}" alt="{{ $alt }}" loading="lazy" />
{{ else if eq $type "video" }}
<video controls preload="metadata">
<source src="{{ $src }}" alt="{{ $alt }}">