feat: complete migration to native lazy loading

One less JS dependency.
This commit is contained in:
George Cushen committed 2021-02-22 21:37:48 +00:00
1 parent 69de00c0cd
commit 432c6326ee
6 files changed
+5 -10

No files matched your search

-5
View File
@@ -60,11 +60,6 @@
version = "8.8.4"
sri = "sha512-as1BF4+iHZ3BVO6LLDQ7zrbvTXM+c/1iZ1qII/c3c4L8Rn5tHLpFUtpaEtBNS92f+xGsCzsD7b62XP3XYap6oA=="
url = "https://cdnjs.cloudflare.com/ajax/libs/mermaid/%s/mermaid.min.js"
[js.lazysizes]
version = "5.2.2"
sri = "sha512-TmDwFLhg3UA4ZG0Eb4MIyT1O1Mb+Oww5kFG0uHqXsdbyZz9DcvYQhKpGgNkamAI6h2lGGZq2X8ftOJvF/XjTUg=="
url = "https://cdnjs.cloudflare.com/ajax/libs/lazysizes/%s/lazysizes.min.js"
async = true
[js.cookieconsent]
version = "3.1.1"
sri = "sha256-5VhCqFam2Cn+yjw61zbBNrbHVJ6SRydPeKopYlngbiQ="
+1 -1
View File
@@ -41,7 +41,7 @@
{{ $image := .Fill (printf "808x455 %s" $anchor) }}
{{ $image_lq := (.Fill (printf "808x455 %s q1" $anchor)).Filter $filters }}
<a href="{{ $item.RelPermalink }}">
<div class="img-hover-zoom"><img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" class="article-banner lazyload" alt="{{ $item.Title }}"></div>
<div class="img-hover-zoom"><img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" class="article-banner" alt="{{ $item.Title }}" loading="lazy"></div>
</a>
{{end}}
+1 -1
View File
@@ -80,7 +80,7 @@
{{ $image := .Resize "150x" }}
{{ $image_lq := (.Resize "150x q1").Filter $filters }}
<a href="{{$link}}" {{ $target | safeHTMLAttr }}>
<img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" class="lazyload">
<img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" loading="lazy">
</a>
{{end}}
</div>
@@ -24,7 +24,7 @@
{{ $image := .Resize "550x" }}
{{ $image_lq := (.Resize "550x q1").Filter $filters }}
<a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="card-image hover-overlay">
<img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" class="img-responsive lazyload">
<img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" class="img-responsive" loading="lazy">
</a>
{{ end }}
<div class="card-text">
@@ -55,7 +55,7 @@
{{ $image := .Resize "540x" }}
{{ $image_lq := (.Resize "540x q1").Filter $filters }}
{{if $do_link}}<a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{end}}
<img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" class="lazyload">
<img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" loading="lazy">
{{if $do_link}}</a>{{end}}
{{end}}
</div>
+1 -1
View File
@@ -29,7 +29,7 @@
{{ end }}
{{ end }}
<a data-fancybox="gallery-{{$album}}" href="{{ .RelPermalink }}" {{ with $caption }}data-caption="{{.|markdownify|emojify|safeHTMLAttr}}"{{ end }}>
<img data-src="{{ $image.RelPermalink }}" class="lazyload" alt="{{ plainify $caption | default $filename }}" width="{{ $image.Width }}" height="{{ $image.Height }}">{{/* Width & height (or low res src) required for lazy loading. */}}
<img data-src="{{ $image.RelPermalink }}" loading="lazy" alt="{{ plainify $caption | default $filename }}" width="{{ $image.Width }}" height="{{ $image.Height }}">{{/* Width & height (or low res src) required for lazy loading. */}}
</a>
{{end}}