Fix render-image.html for SVG

SVG images do not support resizing, so `srcset/src` attributes should be simplified
pull/427/head
Konstantin Pavlov 2022-12-28 10:31:55 +02:00 committed by GitHub
parent 574275d650
commit 5e8d30c305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 10 deletions

View File

@ -15,6 +15,13 @@
{{ end }} {{ end }}
{{ with $resource }} {{ with $resource }}
<figure> <figure>
{{ if eq .MediaType.SubType "svg" }}
<img
class="my-0 rounded-md"
src="{{ .RelPermalink }}"
alt="{{ $altText }}"
/>
{{ else }}
<img <img
class="my-0 rounded-md" class="my-0 rounded-md"
srcset=" srcset="
@ -25,6 +32,7 @@
src="{{ (.Resize "660x").RelPermalink }}" src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}" alt="{{ $altText }}"
/> />
{{ end }}
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure> </figure>
{{ else }} {{ else }}