Skip to content

Commit

Permalink
add browser-level lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
adityatelange committed Mar 16, 2021
1 parent a982a29 commit c353447
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<p>
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} />
<img loading="lazy" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} />
</p>
2 changes: 1 addition & 1 deletion layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end }}
<img src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
<img loading="lazy" src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
Expand Down

0 comments on commit c353447

Please sign in to comment.