Skip to content

Commit 2bcebc3

Browse files
committed
perf: lazy-load lightbox duplicate
The implementation of a lightbox requires that the image in question is rendered twice, once in the actual content and a second time as an off-screen image. Defer loading of that off-screen duplicate until it is needed. Signed-off-by: Luca Zeuch <[email protected]>
1 parent b8b3ad5 commit 2bcebc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

layouts/_default/_markup/render-image.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
{{- if $lightbox -}}
125125
</a>
126126
<a href="javascript:history.back();" class="lightbox" id="{{ print $id "-lightbox" }}">
127-
<img
127+
<img loading="lazy"
128128
{{- range $k, $v := $attrs }}
129129
{{- if or $v (eq $k "alt") }}
130130
{{- printf " %s=%q" $k $v | safeHTMLAttr }}

0 commit comments

Comments
 (0)