Skip to content

Commit

Permalink
Add loading=lazy to img tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
frjo committed Jan 30, 2024
1 parent 31bafbb commit 0376f98
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

<figure class="image{{ with $class }} {{ . }}{{ end }}">
{{ with $link }}<a href="{{ . }}">{{ end -}}
<img src="{{ $src }}"{{ with $srcsetw }} srcset="{{ delimit . ", " }}"{{ end }}{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
<img src="{{ $src }}" loading="lazy"{{ with $srcsetw }} srcset="{{ delimit . ", " }}"{{ end }}{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
{{- if $link }}</a>{{ end }}
{{ if or $title $caption $attr -}}
<figcaption>
Expand Down
2 changes: 1 addition & 1 deletion layouts/shortcodes/img.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@
{{ end -}}

{{ with $link }}<a class="image-link" href="{{ . }}">{{ end -}}
<img class="image{{ with $class }} {{ . }}{{ end }}" src="{{ $src }}"{{ with $srcsetw }} srcset="{{ delimit . ", " }}"{{ end }}{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
<img class="image{{ with $class }} {{ . }}{{ end }}" src="{{ $src }}" loading="lazy"{{ with $srcsetw }} srcset="{{ delimit . ", " }}"{{ end }}{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
{{- if $link }}</a>{{ end }}
2 changes: 1 addition & 1 deletion layouts/shortcodes/svg.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{{ if $inline -}}
<div class="image image--svg{{ with $class }} {{ . }}{{ end }}">{{ $src | safeHTML }}</div>
{{ else -}}
<img class="image image--svg{{ with $class }} {{ . }}{{ end }}" src="{{ $src }}"{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
<img class="image image--svg{{ with $class }} {{ . }}{{ end }}" src="{{ $src }}" loading="lazy"{{ if isset .Params "alt" }} alt="{{ $alt }}"{{ end }}{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>
{{ end -}}
{{- if $link }}</a>{{ end }}
{{ if $caption -}}
Expand Down

0 comments on commit 0376f98

Please sign in to comment.