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
This commit is contained in:
parent
79d8c1db38
commit
79412144d9
@ -1,5 +1,5 @@
|
|||||||
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
|
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
|
||||||
{{- if $image -}}
|
{{- if and $image (ne (path.Ext .Destination) ".svg") -}}
|
||||||
{{- $alt := .PlainText | safeHTML -}}
|
{{- $alt := .PlainText | safeHTML -}}
|
||||||
<figure style="flex-grow: {{ div (mul $image.Width 100) $image.Height }}; flex-basis: {{ div (mul $image.Width 240) $image.Height }}px">
|
<figure style="flex-grow: {{ div (mul $image.Width 100) $image.Height }}; flex-basis: {{ div (mul $image.Width 240) $image.Height }}px">
|
||||||
<a href="{{ $image.RelPermalink }}" data-size="{{ $image.Width }}x{{ $image.Height }}">
|
<a href="{{ $image.RelPermalink }}" data-size="{{ $image.Width }}x{{ $image.Height }}">
|
||||||
|
@ -16,7 +16,11 @@
|
|||||||
{{ if $pageResourceImage }}
|
{{ if $pageResourceImage }}
|
||||||
<!-- If image is found under page bundle -->
|
<!-- If image is found under page bundle -->
|
||||||
{{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
|
{{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
|
||||||
{{ $result = merge $result (dict "resource" $pageResourceImage) }}
|
|
||||||
|
<!-- Disable SVG image processing, not supported by Hugo -->
|
||||||
|
{{ if ne (path.Ext $imageValue) ".svg" }}
|
||||||
|
{{ $result = merge $result (dict "resource" $pageResourceImage) }}
|
||||||
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<!-- Can not find the image under page bundle. Could be a relative linked image -->
|
<!-- Can not find the image under page bundle. Could be a relative linked image -->
|
||||||
{{ $result = merge $result (dict "permalink" $imageValue) }}
|
{{ $result = merge $result (dict "permalink" $imageValue) }}
|
||||||
|
Loading…
Reference in New Issue
Block a user