Commit d92f8eb7 authored by Henk Verlinde's avatar Henk Verlinde
Browse files

feat: convert card images to webp format

parent 77d0890b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@
  {{ range . -}}
  <div class="col">
    <div class="card">
      {{- .Scratch.Set "fillImage" "1270x620 Center" -}}
      {{- .Scratch.Set "fillImageCard" "1270x620 Center" -}}
      {{ partial "content/card-image.html" . }}
      <div class="card-body">
        <article>
+11 −3
Original line number Diff line number Diff line
{{ $fillImage := .Scratch.Get "fillImage" }}
{{ $fillImage := .Scratch.Get "fillImageCard" }}
{{ if not $fillImage -}}
  {{ $fillImage = site.Params.fillImage }}
{{ end -}}
@@ -8,7 +8,15 @@
  {{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }}
{{ end -}}

{{ $image = $image.Fill $fillImage }}
{{ $webp := printf "%s%s" $fillImage " webp" }}
{{ $image = $image.Resize $webp}}

{{ $lqip := $image.Resize site.Params.lqipWidth -}}

<img class="card-img-top img-fluid lazyload blur-up" src="{{ $lqip.Permalink }}" data-src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ .Title }}">
<img
  class="card-img-top img-fluid lazyload blur-up"
  src="{{ $lqip.Permalink }}"
  data-src="{{ $image.Permalink }}"
  width="{{ $image.Width }}"
  height="{{ $image.Height }}"
  alt="{{ .Title }}">