fix singleview con featured svg #102

Merged
paspo merged 2 commits from paspo/bglug.it:fix_single_svg into main 2024-07-14 09:16:07 +00:00

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 }}