fix taxonomies list (#91)
fixes #84 Reviewed-on: #91 Co-authored-by: paspo <paolo@asperti.com> Co-committed-by: paspo <paolo@asperti.com>
This commit is contained in:
parent
687cbae8aa
commit
610a15524a
52
layouts/_default/taxonomyshortblock.html
Normal file
52
layouts/_default/taxonomyshortblock.html
Normal file
@ -0,0 +1,52 @@
|
||||
<section>
|
||||
<div class="box post">
|
||||
|
||||
{{ $rasters := slice "jpeg" "png" }}
|
||||
{{ $newres := "360x250 smart" }}
|
||||
|
||||
{{/* di default, niente immagine */}}
|
||||
{{- $featimg := "#" -}}
|
||||
|
||||
{{- 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>
|
||||
<p>
|
||||
{{ with .Description }}
|
||||
{{- . | truncate 400 }}
|
||||
{{- else }}
|
||||
{{- .Summary | truncate 400 }}
|
||||
{{- end }}
|
||||
</p>
|
||||
{{ partial "tags.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
Loading…
x
Reference in New Issue
Block a user