1
0
forked from BgLUG/bglug.it
bglug.it/layouts/_default/taxonomyshortblock.html

56 lines
2.2 KiB
HTML
Raw Normal View History

<section>
<div class="box post">
{{ $rasters := slice "jpeg" "png" }}
{{ $newres := "360x250 smart" }}
{{/* immagine di default */}}
{{- $featimg := (resources.Get "/images/placeholder_autore.png").RelPermalink -}}
{{- if .Params.image -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img := .Page.Resources.GetMatch .Params.image -}}
{{- if $img -}}
{{- if in $rasters $img.MediaType.SubType -}}
{{- $img = $img.Fill $newres -}}
{{ end }}
{{- $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 -}}
{{- 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 }}
{{- . | markdownify | truncate 400 }}
{{- else }}
{{- .Summary | markdownify | truncate 400 }}
{{- end }}
</p>
{{ partial "tags.html" . }}
</div>
</div>
</section>