summaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-09-18 16:52:44 +0800
committerGitHub <noreply@github.com>2024-09-18 16:52:44 +0800
commit2831ae369eace3913f1fc19568522dcff914de6b (patch)
treec1465e90b462adabb82c4c6e33b89eaa4a8f0163 /modules/templates
parente6395e1e81dd292417b04ce1fe3b51e50d978ca4 (diff)
downloadgitea-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.go2
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)