0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-14 05:51:33 +01:00

Lazy load avatar images (#32051)

This commit is contained in:
hiifong 2024-09-18 03:02:48 +08:00 committed by GitHub
parent 7dde3e6489
commit f38e101448
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)