diff options
author | Giteabot <teabot@gitea.io> | 2024-09-18 16:52:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-18 16:52:44 +0800 |
commit | 2831ae369eace3913f1fc19568522dcff914de6b (patch) | |
tree | c1465e90b462adabb82c4c6e33b89eaa4a8f0163 /modules/templates | |
parent | e6395e1e81dd292417b04ce1fe3b51e50d978ca4 (diff) | |
download | gitea-2831ae369eace3913f1fc19568522dcff914de6b.tar.gz gitea-2831ae369eace3913f1fc19568522dcff914de6b.zip |
Lazy load avatar images (#32051) (#32063)
Backport #32051 by @hiifong
Before:
https://github.com/user-attachments/assets/7b1681ba-4781-432a-ae20-c07e94c1dbb6
After:
https://github.com/user-attachments/assets/5154e160-e22c-460e-b0d9-28768486c178
Co-authored-by: hiifong <i@hiif.ong>
Diffstat (limited to 'modules/templates')
-rw-r--r-- | modules/templates/util_avatar.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/templates/util_avatar.go b/modules/templates/util_avatar.go index 85832cf264..afc1091516 100644 --- a/modules/templates/util_avatar.go +++ b/modules/templates/util_avatar.go @@ -34,7 +34,7 @@ func AvatarHTML(src string, size int, class, name string) template.HTML { name = "avatar" } - return template.HTML(`<img class="` + class + `" src="` + src + `" title="` + html.EscapeString(name) + `" width="` + sizeStr + `" height="` + sizeStr + `"/>`) + return template.HTML(`<img loading="lazy" class="` + class + `" src="` + src + `" title="` + html.EscapeString(name) + `" width="` + sizeStr + `" height="` + sizeStr + `"/>`) } // Avatar renders user avatars. args: user, size (int), class (string) |