mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 17:30:28 -04:00
lazy load images within page content
This commit is contained in:
parent
7f4ee60797
commit
cdf867920e
@ -4,7 +4,7 @@
|
|||||||
<figure>
|
<figure>
|
||||||
{{ with $.Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
|
{{ with $.Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
|
||||||
<picture>
|
<picture>
|
||||||
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
<img src="{{ $optimized.Permalink }}" loading="lazy" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
||||||
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}" title="{{ . | $.Page.RenderString | plainify | safeHTML }}">
|
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}" title="{{ . | $.Page.RenderString | plainify | safeHTML }}">
|
||||||
</picture>
|
</picture>
|
||||||
{{ if $.Get "link" }}</a>{{ end }}
|
{{ if $.Get "link" }}</a>{{ end }}
|
||||||
@ -14,7 +14,7 @@
|
|||||||
{{- else }}
|
{{- else }}
|
||||||
<p class="image">
|
<p class="image">
|
||||||
{{ with .Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
|
{{ with .Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
|
||||||
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
<img src="{{ $optimized.Permalink }}" loading="lazy" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
||||||
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}>
|
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}>
|
||||||
{{ if .Get "link" }}</a>{{ end }}
|
{{ if .Get "link" }}</a>{{ end }}
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user