tema hugo-arcana #74
@ -1,24 +1,38 @@
|
||||
<section class="col-6 col-12-narrower">
|
||||
<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 -}}
|
||||
{{- $featimg = $img.RelPermalink -}}
|
||||
{{- 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 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 -}}
|
||||
{{- else -}}
|
||||
{{/* altrimenti prendo la prima risorsa immagine disponibile */}}
|
||||
{{- $img := (.Page.Resources.ByType "image").GetMatch "**" -}}
|
||||
{{- if $img -}}
|
||||
{{- $featimg = $img.RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user