diff --git a/layouts/partials/plugin/image.html b/layouts/partials/plugin/image.html index bbde8a54c..0c33514b4 100644 --- a/layouts/partials/plugin/image.html +++ b/layouts/partials/plugin/image.html @@ -77,7 +77,7 @@ {{- /* for details, see https://lruihao.cn/posts/native-img-loading-lazy/ */ -}} {{- if eq $loading "lazy" -}} {{- /* TODO move to theme.js */ -}} - {{- $commonScript := "this.title=this.dataset.title;for(const i of ['style', 'data-title','onerror','onload']){this.removeAttribute(i);}" -}} + {{- $commonScript := "this.title=this.dataset.title;this.alt=this.dataset.alt;for(const i of ['style', 'data-title','data-alt','onerror','onload']){this.removeAttribute(i);}" -}} {{- $onload = printf " onload=\"%vthis.dataset.lazyloaded='';\"" $commonScript | safeHTMLAttr -}} {{- $onerror = printf " onerror=\"%v\"" $commonScript | safeHTMLAttr -}} {{- $style = printf " style=\"%vbackground: url(%v) no-repeat center;\"" $style (resources.Get "images/loading.svg" | minify).RelPermalink | safeHTMLAttr -}} @@ -87,10 +87,10 @@ {{- if .Linked -}} {{- end -}} -