feat: convert card images to webp format
This commit is contained in:
parent
77d0890ba4
commit
d92f8eb79e
|
@ -39,7 +39,7 @@
|
||||||
{{ range . -}}
|
{{ range . -}}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
{{- .Scratch.Set "fillImage" "1270x620 Center" -}}
|
{{- .Scratch.Set "fillImageCard" "1270x620 Center" -}}
|
||||||
{{ partial "content/card-image.html" . }}
|
{{ partial "content/card-image.html" . }}
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<article>
|
<article>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $fillImage := .Scratch.Get "fillImage" }}
|
{{ $fillImage := .Scratch.Get "fillImageCard" }}
|
||||||
{{ if not $fillImage -}}
|
{{ if not $fillImage -}}
|
||||||
{{ $fillImage = site.Params.fillImage }}
|
{{ $fillImage = site.Params.fillImage }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
@ -8,7 +8,15 @@
|
||||||
{{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }}
|
{{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
{{ $image = $image.Fill $fillImage }}
|
{{ $webp := printf "%s%s" $fillImage " webp" }}
|
||||||
|
{{ $image = $image.Resize $webp}}
|
||||||
|
|
||||||
{{ $lqip := $image.Resize site.Params.lqipWidth -}}
|
{{ $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 }}">
|
||||||
|
|
Loading…
Reference in New Issue