🔀 Merge pull request #427 from kpavlov/patch-1

🐛 Fix render-image.html for SVG
pull/435/head
James Panther 2023-01-09 16:43:27 +11:00 committed by GitHub
commit efe48e0f44
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,16 +15,24 @@
{{ end }}
{{ with $resource }}
<figure>
<img
class="my-0 rounded-md"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}"
/>
{{ if eq .MediaType.SubType "svg" }}
<img
class="my-0 rounded-md"
src="{{ .RelPermalink }}"
alt="{{ $altText }}"
/>
{{ else }}
<img
class="my-0 rounded-md"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}"
/>
{{ end }}
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{ else }}