Skip to content

Commit c353447

Browse files
committed
add browser-level lazy loading
ref: https://web.dev/browser-level-image-lazy-loading/
1 parent a982a29 commit c353447

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<p>
2-
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} />
2+
<img loading="lazy" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} />
33
</p>

layouts/shortcodes/figure.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{- if .Get "link" -}}
66
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
77
{{- end }}
8-
<img src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
8+
<img loading="lazy" src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
99
{{- if or (.Get "alt") (.Get "caption") }}
1010
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
1111
{{- end -}}

0 commit comments

Comments
 (0)