Merge pull request #19332 from dvdksn/lazy-load-images

site: add lazy loading for images
This commit is contained in:
David Karlsson 2024-02-07 17:28:39 +01:00 committed by GitHub
commit 3a3dca08ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,7 @@
class="cursor-pointer hover:opacity-90" class="cursor-pointer hover:opacity-90"
> >
<img <img
loading="lazy"
src="{{ $imagePath }}" src="{{ $imagePath }}"
alt="{{ .Text }}" alt="{{ .Text }}"
{{ with $width }} {{ with $width }}
@ -39,6 +40,7 @@
{{ partial "icon" "close" }} {{ partial "icon" "close" }}
</button> </button>
<img <img
loading="lazy"
class="rounded max-w-full max-h-full" class="rounded max-w-full max-h-full"
src="{{ $imagePath }}" src="{{ $imagePath }}"
alt="{{ .Text }}" alt="{{ .Text }}"

View File

@ -7,6 +7,7 @@
{{ end }} {{ end }}
<img <img
loading="lazy"
src="{{ $src }}" src="{{ $src }}"
alt="{{ $alt }}" alt="{{ $alt }}"
{{ with $title }}title="{{ . }}"{{ end }} {{ with $title }}title="{{ . }}"{{ end }}