summaryrefslogtreecommitdiff
path: root/layouts/shortcodes
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-04-30 15:48:21 +0800
committerEltrac <hi@guhub.cn>2025-04-30 15:48:21 +0800
commitc3d7ac143700effaea74847bb2a128db1af38b41 (patch)
treea68e9bbb3fd78493a83862b7ebd28668699890ad /layouts/shortcodes
parentaa1c79bdfbc1713f449129297ef7d72e28644f10 (diff)
chore: deal with image lazyloading
- lazyload post banner image - lazyload book cover - tidy up lazyload attributes in image shortcode Former-commit-id: 4ed06823920334eeea2e9e00c0fc45c3e2978888
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/img.html7
1 files changed, 6 insertions, 1 deletions
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html
index cb2d2571..10005506 100644
--- a/layouts/shortcodes/img.html
+++ b/layouts/shortcodes/img.html
@@ -2,7 +2,12 @@
<figure {{ with .Get "class" }}class="{{ . }}"{{ end }}>
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<a href="{{ .Get "src" }}" data-fancybox {{ if isset .Params "title" }} data-caption="{{.Get "title" }}" {{ end }}>
- <img class="lazy" data-src="{{ .Get "src" }}" src="{{ .Get "src" }}!thumbnail" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }} />
+ <img
+ class="lazy"
+ data-src="{{ .Get "src" }}"
+ src="{{ .Get "src" }}!thumbnail"
+ {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }}
+ />
</a>
{{ if .Get "link" }}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}