commit cb0dd5a10dbde4bd5135c0046b270e9299211c3b
parent 38d46a1b8a37993a0f3f7c336cc74232077e5529
Author: MichaĆ M. Sapka <michal@sapka.me>
Date: Thu, 9 Feb 2023 16:18:12 +0100
chore: use webp in modern shortcodes
Diffstat:
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
@@ -48,7 +48,7 @@
<div id="logo-space">
<a href="/">
{{ $image := resources.Get "logo.png" }}
- {{ $image := $image.Resize "x160" }}
+ {{ $image := $image.Resize "x160 webpn" }}
<div id="logo">
<img alt="logo" src="{{ $image.Permalink }}" width={{$image.Width}} height={{$image.Height}}/>
</div>
diff --git a/layouts/shortcodes/img-center.html b/layouts/shortcodes/img-center.html
@@ -3,7 +3,7 @@
{{- $img := resources.Get $path }}
{{- $caption := .Get 1 }}
{{- $source := .Get 2 }}
-{{- $img = $img.Resize "500x" }}
+{{- $img = $img.Resize "500x webp" }}
<figure>
<img class="centered" alt="{{ $caption }}" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
<figcaption>
diff --git a/layouts/shortcodes/img-pull-right.html b/layouts/shortcodes/img-pull-right.html
@@ -1,6 +1,6 @@
{{- $file := .Get 0 }}
{{- $path := printf "content_images/%s" $file}}
{{- $img := resources.Get $path }}
-{{- $img = $img.Resize "150x" }}
+{{- $img = $img.Resize "150x webp" }}
{{- $caption := .Get 1}}
<img class="float-right" alt="{{ $caption }}" src="{{ $img.Permalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
diff --git a/layouts/shortcodes/youtube.html b/layouts/shortcodes/youtube.html
@@ -1,11 +1,11 @@
{{- $id := .Get 0 }}
{{- $title := .Get 1 }}
{{- $path := printf "ytcovers/%s.jpg" $id}}
-{{- $image := resources.Get $path }}
-{{- $image = $image.Resize "x300" }}
+{{- $img := resources.Get $path }}
+{{- $img = $img.Resize "x300 webp" }}
<center>
<a href="https://www.youtube.com/watch?v={{$id}}" target="_blank">
- <img src="{{$image.Permalink}}" alt="{{$title}} on Youtube"/>
+ <img src="{{$img.Permalink}}" alt="{{$title}} on Youtube" width="{{$img.Width}}" height="{{$img.Height}}"/>
</a>
</center>