Skip to content

Commit

Permalink
feat: lazy load images when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud committed May 26, 2024
1 parent 357d445 commit dfc113a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(dict "Process" "resize 1600x webp q75" "descriptor" "1600w")
-}}
<figure>
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" $lightgallery "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" $lightgallery "Loading" "lazy" "Sizes" "auto" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- if .Title -}}
<figcaption class="image-caption">
{{- .Title | safeHTML -}}
Expand Down
2 changes: 2 additions & 0 deletions layouts/shortcodes/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
(dict "Process" "resize 1600x webp q75" "descriptor" "1600w")
-}}
{{- $options = dict "OptimConfig" $optim | merge $options -}}
{{- $options = dict "Loading" "lazy" | merge $options -}}
{{- $options = dict "Sizes" "auto" | merge $options -}}


{{- if .IsNamedParams -}}
Expand Down

0 comments on commit dfc113a

Please sign in to comment.