add browser-level lazy loading
ref: https://web.dev/browser-level-image-lazy-loading/
This commit is contained in:
parent
a982a29e24
commit
c353447d8e
|
@ -1,3 +1,3 @@
|
|||
<p>
|
||||
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} />
|
||||
<img loading="lazy" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} />
|
||||
</p>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{{- if .Get "link" -}}
|
||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{- end }}
|
||||
<img src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
|
||||
<img loading="lazy" src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
|
||||
{{- if or (.Get "alt") (.Get "caption") }}
|
||||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
||||
{{- end -}}
|
||||
|
|
Loading…
Reference in New Issue