fix singleview con featured svg (#102)

Reviewed-on: #102
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
This commit is contained in:
Paolo Asperti 2024-07-14 09:16:04 +00:00 committed by omartek
parent b480fb2c95
commit 98a28b70ea

View File

@ -11,6 +11,7 @@
{{- if or .Params.image .Params.featured }}
{{- $maxHeight := 600 -}}
{{ $rasters := slice "jpeg" "png" }}
{{- $img := "#" -}}
{{- if .Params.image -}}
@ -22,11 +23,14 @@
{{/* se è stata definita un'immagine featured */}}
{{- $img = .Page.Resources.GetMatch .Params.featured -}}
{{- end -}}
{{- $image := $img.Resize (printf "x%d" $maxHeight) -}}
<span class="image featured">
<img src="{{ $image.RelPermalink }}" alt="{{ .Params.image_alt }}" style="width: {{ $image.Width }}px; max-height: {{ $maxHeight }}px;" />
{{- if in $rasters $img.MediaType.SubType -}}
{{- $img = $img.Resize (printf "x%d" $maxHeight) -}}
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="width: {{ $img.Width }}px; max-height: {{ $maxHeight }}px;" />
{{ else }}
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="max-height: {{ $maxHeight }}px;" />
{{ end }}
</span>
{{ end }}