bglug.it/layouts/partials/homepage/blocks/posts_homepage.html
paspo dbbe645aaf homepage-list (#329)
fixes #320

Reviewed-on: #329
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
2024-10-31 22:04:28 +00:00

31 lines
981 B
HTML

{{- $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 }}