fix immagini mancanti

This commit is contained in:
Paolo Asperti 2024-07-07 00:15:38 +02:00
parent bd4396de86
commit 0f875ea654
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -0,0 +1,40 @@
<section class="col-6 col-12-narrower">
<div class="box post">
{{/* di default, niente immagine */}}
{{- $featimg := "#" -}}
{{- if .Params.image -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img := .Page.Resources.GetMatch .Params.image -}}
{{- $featimg = $img.RelPermalink -}}
{{- else -}}
{{- if .Params.featured -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img := .Page.Resources.GetMatch .Params.featured -}}
{{- $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 -}}
<a href="{{ .RelPermalink }}" class="image left"><img src="{{ $featimg }}" alt="{{ .Params.image_alt }}" /></a>
<div class="inner">
<h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ if .Site.Params.show_post_dates | default true }}
{{- with .Date }}<time>{{ . | time.Format ":date_medium" }}</time>{{ end }}
{{ end }}
<p>
{{ with .Description }}
{{- . }}
{{- else }}
{{- .Summary }}
{{- end }}
</p>
</div>
</div>
</section>