From ae3473dcea1a4bf11ccb887f1209324267f7c028 Mon Sep 17 00:00:00 2001 From: Simon C Date: Tue, 1 Feb 2022 12:12:02 +0100 Subject: [PATCH] feat: Add new parameters on hugo to fix resize image --- layouts/_default/_markup/render-image.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 86a9c64..7a5a89a 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -4,7 +4,8 @@ {{ $path := cond (in .Destination "/") .Destination (path.Join "/" .Page.File.Dir .Destination) }} {{ $image := .Page.Resources.GetMatch (printf "*%s*" .Destination) }} {{ with $image }} - {{ $resized := $image.Resize "610x q100 webp" }} + {{ $resizeParams := delimit (slice (default "610x" site.Params.ImageSize) (default "q100" site.Params.ImageQuality) (default "webp" site.Params.ImageFormat)) " " }} + {{ $resized := $image.Resize (string $resizeParams) }} {{ $path = $resized.RelPermalink }} {{ end }} {{ .Text }}