Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 05:06:11 +01:00

Lazy load avatar images (#32051)

(cherry picked from commit f38e1014483b84f4541ffb354cd5dfdd7e000e2c)
This commit is contained in:
hiifong 2024-09-18 03:02:48 +08:00 committed by Earl Warren
parent 0cafec4c7a
commit 9d5f409a5a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -34,7 +34,7 @@ func AvatarHTML(src string, size int, class, name string) template.HTML {
name = "avatar" 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) // Avatar renders user avatars. args: user, size (int), class (string)