immagine laterale riempita a dimensioni fisse

This commit is contained in:
Paolo Asperti 2024-07-07 09:17:44 +02:00
parent 4cbce336b8
commit 6251b2aa46
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -1,24 +1,38 @@
<section class="col-6 col-12-narrower"> <section class="col-6 col-12-narrower">
<div class="box post"> <div class="box post">
{{ $rasters := slice "jpeg" "png" }}
{{ $newres := "360x250 smart" }}
{{/* di default, niente immagine */}} {{/* di default, niente immagine */}}
{{- $featimg := "#" -}} {{- $featimg := "#" -}}
{{- if .Params.image -}} {{- if .Params.image -}}
{{/* se è stata definita un'immagine featured */}} {{/* se è stata definita un'immagine featured */}}
{{- $img := .Page.Resources.GetMatch .Params.image -}} {{- $img := .Page.Resources.GetMatch .Params.image -}}
{{- $featimg = $img.RelPermalink -}} {{- if $img -}}
{{- else -}} {{- if in $rasters $img.MediaType.SubType -}}
{{- if .Params.featured -}} {{- $img = $img.Fill $newres -}}
{{/* se è stata definita un'immagine featured */}} {{ end }}
{{- $img := .Page.Resources.GetMatch .Params.featured -}} {{- $featimg = $img.RelPermalink -}}
{{- end -}}
{{- else if .Params.featured -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img := .Page.Resources.GetMatch .Params.featured -}}
{{- if $img -}}
{{- if in $rasters $img.MediaType.SubType -}}
{{- $img = $img.Fill $newres -}}
{{ end }}
{{- $featimg = $img.RelPermalink -}}
{{- end -}}
{{- else -}}
{{/* altrimenti prendo la prima risorsa immagine disponibile */}}
{{- $img := (.Page.Resources.ByType "image").GetMatch "**" -}}
{{- if $img -}}
{{- if in $rasters $img.MediaType.SubType -}}
{{- $img = $img.Fill $newres -}}
{{ end }}
{{- $featimg = $img.RelPermalink -}} {{- $featimg = $img.RelPermalink -}}
{{- else -}}
{{/* altrimenti prendo la prima risorsa immagine disponibile */}}
{{- $img := (.Page.Resources.ByType "image").GetMatch "**" -}}
{{- if $img -}}
{{- $featimg = $img.RelPermalink -}}
{{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}