homepage grouping #308

Merged
paspo merged 5 commits from paspo/bglug.it:homepage-grouping into main 2024-10-28 07:06:04 +00:00
2 changed files with 23 additions and 8 deletions
Showing only changes of commit 7a72373ce4 - Show all commits

View File

@ -12,15 +12,10 @@ items:
link: link:
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
type: posts_homepage_grouping
- 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"
- heading: Ultimi post
type: posts
content_type: posts
max: 4
- heading: Ultimi Eventi
type: posts
content_type: events
max: 4
- type: highlights - type: highlights
items_per_row: 2 items_per_row: 2
items: items:

View File

@ -0,0 +1,20 @@
{{- $pages := (where .ctx.Site.Pages ".Params.grouping" "intersect" (slice "homepage")) }}
{{- if gt (len $pages) 0 }}
<section class="wrapper style1">
<div class="container">
{{ with .item.heading }}<h2>{{ . }}</h2>{{ 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 }}