featured_first
This commit is contained in:
parent
7a72373ce4
commit
2d18734e47
@ -13,6 +13,7 @@ items:
|
|||||||
url: /it/posts/2024/09/2024-09-28-cambio-entrata/
|
url: /it/posts/2024/09/2024-09-28-cambio-entrata/
|
||||||
title: Più informazioni
|
title: Più informazioni
|
||||||
max: 6
|
max: 6
|
||||||
|
featured_first: true
|
||||||
type: posts_homepage_grouping
|
type: posts_homepage_grouping
|
||||||
- heading: Ultimi post ed eventi
|
- heading: Ultimi post ed eventi
|
||||||
contents: "L'entrata è stata spostata in Via San Giovanni Bosco 16"
|
contents: "L'entrata è stata spostata in Via San Giovanni Bosco 16"
|
||||||
|
@ -1,65 +1,3 @@
|
|||||||
<section class="col-6 col-12-narrower">
|
<section class="col-6 col-12-narrower">
|
||||||
<div class="box post">
|
{{- .Render "shortblock_common" -}}
|
||||||
|
|
||||||
{{ $rasters := slice "jpeg" "png" }}
|
|
||||||
{{ $newres := "360x250 smart" }}
|
|
||||||
|
|
||||||
{{/* immagine di default */}}
|
|
||||||
{{- $featimg := (resources.Get "/images/placeholder_elenco.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>
|
|
||||||
|
|
||||||
{{- with .GetTerms "author" }}
|
|
||||||
{{- range . -}}
|
|
||||||
<div class="author">
|
|
||||||
di <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
|
||||||
</div>
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
|
|
||||||
{{ if .Site.Params.show_post_dates | default true }}
|
|
||||||
{{- with .Date }}<time>{{ . | time.Format ":date_medium" }}</time>{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
<p>
|
|
||||||
{{ with .Description }}
|
|
||||||
{{- . | plainify | truncate 400 }}
|
|
||||||
{{- else }}
|
|
||||||
{{- .Summary | plainify | truncate 400 }}
|
|
||||||
{{- end }}
|
|
||||||
</p>
|
|
||||||
{{ partial "tags.html" . }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
63
layouts/_default/shortblock_common.html
Normal file
63
layouts/_default/shortblock_common.html
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<div class="box post">
|
||||||
|
|
||||||
|
{{ $rasters := slice "jpeg" "png" }}
|
||||||
|
{{ $newres := "360x250 smart" }}
|
||||||
|
|
||||||
|
{{/* immagine di default */}}
|
||||||
|
{{- $featimg := (resources.Get "/images/placeholder_elenco.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>
|
||||||
|
|
||||||
|
{{- with .GetTerms "author" }}
|
||||||
|
{{- range . -}}
|
||||||
|
<div class="author">
|
||||||
|
di <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
||||||
|
</div>
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{ if .Site.Params.show_post_dates | default true }}
|
||||||
|
{{- with .Date }}<time>{{ . | time.Format ":date_medium" }}</time>{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
<p>
|
||||||
|
{{ with .Description }}
|
||||||
|
{{- . | plainify | truncate 400 }}
|
||||||
|
{{- else }}
|
||||||
|
{{- .Summary | plainify | truncate 400 }}
|
||||||
|
{{- end }}
|
||||||
|
</p>
|
||||||
|
{{ partial "tags.html" . }}
|
||||||
|
</div>
|
||||||
|
</div>
|
3
layouts/_default/shortblock_wide.html
Normal file
3
layouts/_default/shortblock_wide.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<section class="col-12 col-12-narrower">
|
||||||
|
{{- .Render "shortblock_common" -}}
|
||||||
|
</section>
|
@ -3,6 +3,14 @@
|
|||||||
<section class="wrapper style1">
|
<section class="wrapper style1">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{ with .item.heading }}<h2>{{ . }}</h2>{{ end }}
|
{{ with .item.heading }}<h2>{{ . }}</h2>{{ end }}
|
||||||
|
{{ if eq .item.featured_first true }}
|
||||||
|
<div class="row">
|
||||||
|
{{- range $idx, $itm := first 1 $pages }}
|
||||||
|
{{- .Render "shortblock_wide" -}}
|
||||||
|
{{- end }}
|
||||||
|
</div>
|
||||||
|
{{- $pages = after 1 $pages }}
|
||||||
|
{{- end }}
|
||||||
{{- range $idx, $itm := first (.item.max | default 4) $pages }}
|
{{- range $idx, $itm := first (.item.max | default 4) $pages }}
|
||||||
{{- $rowpos := mod $idx 2 }}
|
{{- $rowpos := mod $idx 2 }}
|
||||||
{{- if eq $rowpos 0 }}
|
{{- if eq $rowpos 0 }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user