fix dimensione immagine in single view (#94)

fixes #93 #86

Reviewed-on: #94
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
This commit is contained in:
Paolo Asperti 2024-07-13 18:19:41 +00:00 committed by omartek
parent 8582140810
commit cb69696416

View File

@ -8,23 +8,26 @@
{{ partial "tags.html" . }}
</header>
{{- if or .Params.image }}
{{- if or .Params.image .Params.featured }}
{{- $featimg := "#" -}}
{{- $maxHeight := 600 -}}
{{- $img := "#" -}}
{{- if .Params.image -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img := .Page.Resources.GetMatch .Params.image -}}
{{- $featimg = $img.RelPermalink -}}
{{- $img = .Page.Resources.GetMatch .Params.image -}}
{{- end -}}
{{- if .Params.featured -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img := .Page.Resources.GetMatch .Params.featured -}}
{{- $featimg = $img.RelPermalink -}}
{{- $img = .Page.Resources.GetMatch .Params.featured -}}
{{- end -}}
{{- $image := $img.Resize (printf "x%d" $maxHeight) -}}
<span class="image featured"><img src="{{ $featimg }}" alt="{{ .Params.image_alt }}" /></span>
<span class="image featured">
<img src="{{ $image.RelPermalink }}" alt="{{ .Params.image_alt }}" style="width: {{ $image.Width }}px; max-height: {{ $maxHeight }}px;" />
</span>
{{ end }}
{{- .Content }}