summaryrefslogtreecommitdiff
path: root/layouts/shortcodes
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-05-06 10:42:37 +0800
committerEltrac <hi@guhub.cn>2025-05-06 10:42:37 +0800
commitcee2e91904d09f075aba3eef8efe4929eca825a6 (patch)
treecd939b89ff59bafcdc422283ea2f20e00876f8cf /layouts/shortcodes
parentf9dba04514035df037521debb6de13e193a68816 (diff)
fix: avoid showing thumbnail in source
The old lazy-loading solution requires an extra data-src attribute where the real image url is set. The script will replace src with data-src value when img tag is observed. But this caused a problem: Third-party applications like RSS readers do not load script, hence the image source is always the placeholder (a blurry version of the real image). Considering the fact that a placeholder image does not improve user experience that well, I removed it.
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/img.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html
index 10005506..01d0684b 100644
--- a/layouts/shortcodes/img.html
+++ b/layouts/shortcodes/img.html
@@ -4,8 +4,8 @@
<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"
+ loading="lazy"
+ src="{{ .Get "src" }}"
{{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }}
/>
</a>