From de34b1cad8c22cc33cb4f04488bc532fb1caf1bc Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Tue, 19 Nov 2024 09:12:01 +0000 Subject: [PATCH] Support for SVG placeholder --- themes/nluug/layouts/partials/show-image.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/themes/nluug/layouts/partials/show-image.html b/themes/nluug/layouts/partials/show-image.html index 292e23a..1c8e4bb 100644 --- a/themes/nluug/layouts/partials/show-image.html +++ b/themes/nluug/layouts/partials/show-image.html @@ -3,6 +3,7 @@ {{ $isJPG := eq (path.Ext .image) ".jpg" }} {{ $isPNG := eq (path.Ext .image) ".png" }} + {{ $isSVG := eq (path.Ext .image) ".svg" }} {{ if ($isJPG) -}} {{ $webpPath:= replace .image ".jpg" ".webp" }} @@ -21,9 +22,13 @@ {{- end }} {{- end }} - {{ $img := imageConfig (add "/static" (.image | safeURL)) }} - {{ .alt }} + {{ if or ($isJPG) ($isPNG) }} + {{ $img := imageConfig (add "/static" (.image | safeURL)) }} + {{ .alt }} + {{ else if ($isSVG) }} + {{ .alt }} + {{ end }} {{ if .figcaption }}