Skip to content

Commit

Permalink
Smaller images
Browse files Browse the repository at this point in the history
  • Loading branch information
AnXh3L0 committed Feb 8, 2025
1 parent c5dee20 commit 2ee0ff8
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions layouts/partials/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
{{ $img := resources.Get (printf "%s%s" $imagePath $image.file) }}

{{ if $img }}
<!-- Create responsive WebP versions -->
{{ $base := $img.Resize "400x webp q80" }}
{{ $medium := $img.Resize "800x webp q80" }}
{{ $large := $img.Resize "1200x webp q80" }}
{{ $xl := $img.Resize "1600x webp q85" }}
{{ $base := $img.Resize "300x webp q70" }}
{{ $medium := $img.Resize "400x webp q70" }}

<li class="w-44 flex-none snap-center sm:w-72">
<figure
Expand All @@ -31,10 +28,8 @@

sizes="(max-width: 640px) 90vw, (max-width: 1024px) 40vw, 25vw"
srcset="{{ if $base }}{{ $base.RelPermalink }} 400w{{ end }}
{{ if $medium }}, {{ $medium.RelPermalink }} 800w{{ end }}
{{ if $large }}, {{ $large.RelPermalink }} 1200w{{ end }}
{{ if $xl }}, {{ $xl.RelPermalink }} 1600w{{ end }}"
src="{{ $xl.RelPermalink | default $img.RelPermalink }}"
{{ if $medium }}, {{ $medium.RelPermalink }} 800w{{ end }}"
src="{{ $medium.RelPermalink | default $img.RelPermalink }}"

width="{{ $img.Width }}"
height="{{ $img.Height }}"
Expand Down

0 comments on commit 2ee0ff8

Please sign in to comment.