1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-06 17:40:57 +00:00

add lazy loading attribute to images

This commit is contained in:
Bente Groh 2025-06-24 22:59:15 +02:00
parent 6d4554b01c
commit cfeda81e2a
2 changed files with 4 additions and 0 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)