Simon Gardling 032679b34a setup
2023-10-11 17:38:05 -04:00

42 lines
1.5 KiB
HTML

{{ define "content" }}
{{ if and .Content (eq .Paginator.PageNumber 1) }}
<div class="content-margin">
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
</div>
{{ end }}
{{- $group_by_year := .Params.group_by_year | default .Site.Params.list_layout.enable_group_by_year | default true -}}
{{- $show_date := .Params.show_date | default .Site.Params.list_layout.enable_show_date | default true -}}
{{- $pagination := .Params.pagination | default .Site.Params.list_layout.enable_pagination | default false -}}
{{- $pages := .Pages -}}
{{- if and $pagination $group_by_year -}}
{{ $pages = (.Paginate (.Pages.GroupByPublishDate "2006")).PageGroups }}
{{- else if and $pagination (not $group_by_year) -}}
{{ $pages = .Paginator.Pages }}
{{- else if and (not $pagination) $group_by_year -}}
{{ $pages = .Pages.GroupByPublishDate "2006" }}
{{- end -}}
{{ if $group_by_year }}
{{ range $pages }}
<div class="content-margin">
<h1>{{- .Key -}}</h1>
{{- partial "list.html" (dict "pages" .Pages "show_date" $show_date "group_by_year" $group_by_year) -}}
</div>
{{ end }}
{{ if $pagination }}
{{ template "_internal/pagination.html" . }}
{{ end }}
{{ else }}
<div class="content-margin">
{{- partial "list.html" (dict "pages" $pages "show_date" $show_date "group_by_year" $group_by_year) -}}
</div>
{{ if $pagination }}
{{ template "_internal/pagination.html" . }}
{{ end }}
{{ end }}
{{ end }}