From 79412144d92a3f08184b6951e291b55cac28a22e Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Sat, 13 Feb 2021 12:57:19 +0100 Subject: [PATCH] fix: disable svg image processing (#144) * fix: disable svg image processing closes https://github.com/CaiJimmy/hugo-theme-stack/issues/132 * style: remove extra blank space --- layouts/_default/_markup/render-image.html | 2 +- layouts/partials/helper/image.html | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 21f650a..e13896a 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,5 +1,5 @@ {{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}} -{{- if $image -}} +{{- if and $image (ne (path.Ext .Destination) ".svg") -}} {{- $alt := .PlainText | safeHTML -}}
diff --git a/layouts/partials/helper/image.html b/layouts/partials/helper/image.html index 8534592..8791aa7 100644 --- a/layouts/partials/helper/image.html +++ b/layouts/partials/helper/image.html @@ -16,7 +16,11 @@ {{ if $pageResourceImage }} {{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }} - {{ $result = merge $result (dict "resource" $pageResourceImage) }} + + + {{ if ne (path.Ext $imageValue) ".svg" }} + {{ $result = merge $result (dict "resource" $pageResourceImage) }} + {{ end }} {{ else }} {{ $result = merge $result (dict "permalink" $imageValue) }}