homepage-list (#329)

fixes #320

Reviewed-on: BgLUG/bglug.it#329
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
This commit is contained in:
Paolo Asperti 2024-10-31 22:04:28 +00:00 committed by Paolo Asperti
parent 58894ae249
commit dbbe645aaf
3 changed files with 40 additions and 2 deletions

View File

@ -14,9 +14,13 @@ items:
title: More information title: More information
contents: "The entrance has been moved to Via San Giovanni Bosco 16" contents: "The entrance has been moved to Via San Giovanni Bosco 16"
- heading: Latest posts and events - heading: Latest posts and events
type: posts_homepage_grouping type: posts_homepage
max: 6 max: 6
featured_first: true featured_first: true
sections:
- events
- linuxday
- posts
- type: highlights - type: highlights
items_per_row: 2 items_per_row: 2
items: items:

View File

@ -14,9 +14,13 @@ items:
title: Più informazioni title: Più informazioni
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 ed eventi - heading: Ultimi post ed eventi
type: posts_homepage_grouping type: posts_homepage
max: 6 max: 6
featured_first: true featured_first: true
sections:
- events
- linuxday
- posts
- type: highlights - type: highlights
items_per_row: 2 items_per_row: 2
items: items:

View File

@ -0,0 +1,30 @@
{{- $pages := (where .ctx.Site.RegularPages "Section" "in" .item.sections ) }}
{{- $pages := (where $pages ".Params.homepage" "ne" false ) }}
{{- 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 }}