feat: Make image lazy load togglable

This commit is contained in:
Tomy Hsieh
2023-05-27 05:31:23 +08:00
parent adf7f6f224
commit 88c73a3aae
9 changed files with 44 additions and 10 deletions
+3 -1
View File
@@ -8,7 +8,9 @@
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
{{- end -}}
loading="lazy"
{{ if .Site.Params.enableImageLazyLoading | default true }}
loading="lazy"
{{ end }}
width="100%"
height="auto"
style="max-width:{{ div $image.Width 2 }}px; max-height:{{ div $image.Height 2 }}px;"