visualizza solo posts di alcune categorie in homepage

This commit is contained in:
Paolo Asperti 2024-10-31 21:54:39 +01:00
parent 58894ae249
commit 45a35dc792
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -0,0 +1,28 @@
{{- $pages := (where .ctx.Site.RegularPages "Section" "in" .item.sections ) }}
{{- if gt (len $pages) 0 }}
<section class="wrapper style1">
<div class="container">
{{ 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 }}
{{- $rowpos := mod $idx 2 }}
{{- if eq $rowpos 0 }}
<div class="row">
{{ end }}
{{- .Render "shortblock" -}}
{{ if or (eq $rowpos 1) (eq $idx (len $pages)) -}}
</div>
{{- end }}
{{- end }}
</div>
</section>
{{ end }}