mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 10:21:46 +01:00
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
2 changed files with 6 additions and 2 deletions
|
@ -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 -}}
|
||||
<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 }}">
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
{{ if $pageResourceImage }}
|
||||
<!-- If image is found under page bundle -->
|
||||
{{ $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 }}
|
||||
<!-- Can not find the image under page bundle. Could be a relative linked image -->
|
||||
{{ $result = merge $result (dict "permalink" $imageValue) }}
|
||||
|
|
Loading…
Reference in a new issue