1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-09-20 19:06:58 +00:00

Add lazy loading attribute in templates

This commit is contained in:
Bente Groh 2025-06-25 00:28:03 +02:00
parent cea717b228
commit 1f8f7f20c0
2 changed files with 2 additions and 2 deletions

View file

@ -4,7 +4,7 @@
{{if $attachments}} {{if $attachments}}
<div class="card-attachment-images"> <div class="card-attachment-images">
{{range $attachments}} {{range $attachments}}
<img src="{{.DownloadURL}}" alt="{{.Name}}" /> <img src="{{.DownloadURL}}" alt="{{.Name}}" loading="lazy"/>
{{end}} {{end}}
</div> </div>
{{end}} {{end}}

View file

@ -31,7 +31,7 @@
{{if FilenameIsImage .Name}} {{if FilenameIsImage .Name}}
{{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}} {{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}}
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}"> <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
<img alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}"> <img alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}" loading="lazy">
</a> </a>
{{end}} {{end}}
{{end}} {{end}}