[v12.0/forgejo] fix(ui): add missing lazy load attribute to images (#8282)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8246

closes #8076

Co-authored-by: Bente Groh <mail@bentegroh.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8282
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
forgejo-backport-action 2025-06-25 20:42:35 +02:00 committed by Beowulf
commit aa648d74ea
10 changed files with 67 additions and 59 deletions

View file

@ -44,6 +44,7 @@ func (g *ASTTransformer) transformImage(ctx *markup.RenderContext, v *ast.Image)
for _, attr := range v.Attributes() {
image.SetAttribute(attr.Name, attr.Value)
}
image.SetAttributeString("loading", []byte("lazy"))
for child := v.FirstChild(); child != nil; {
next := child.NextSibling()
image.AppendChild(image, child)