Add SVG support to article featured images

This commit is contained in:
James Panther
2023-01-15 10:38:53 +11:00
parent b9bb291a8d
commit 7e970f4c97
6 changed files with 60 additions and 25 deletions
+9 -5
View File
@@ -13,12 +13,16 @@
aria-label="{{ $.Title | emojify }}"
>
<img
class="w-24 rounded-md sm:w-40"
srcset="
{{- (.Fill "160x120 smart").RelPermalink }} 160w,
{{- (.Fill "320x240 smart").RelPermalink }} 2x"
src="{{ (.Fill "160x120 smart").RelPermalink }}"
alt="{{ $.Params.featureAlt | default $.Params.thumbnailAlt | default "" }}"
{{ if eq .MediaType.SubType "svg" }}
class="w-24 max-w-[6rem] max-h-[4.5rem] rounded-md sm:max-h-[7.5rem] sm:w-40
sm:max-w-[10rem]" src="{{ .RelPermalink }}"
{{ else }}
class="w-24 rounded-md sm:w-40" srcset="
{{- (.Fill "160x120 smart").RelPermalink }}
160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x"
src="{{ (.Fill "160x120 smart").RelPermalink }}"
{{ end }}
/>
</a>
</div>