diff options
| author | Eltrac <hi@guhub.cn> | 2025-04-30 15:48:21 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-04-30 15:48:21 +0800 |
| commit | c3d7ac143700effaea74847bb2a128db1af38b41 (patch) | |
| tree | a68e9bbb3fd78493a83862b7ebd28668699890ad /layouts/shortcodes | |
| parent | aa1c79bdfbc1713f449129297ef7d72e28644f10 (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.html | 7 |
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") }} |
