{{- define "main" }} {{- $pages := where site.RegularPages "Section" "in" site.Params.mainSections }} {{- if site.Params.ShowAllPagesInArchive }} {{- $pages = site.RegularPages }} {{- end }}
{{- $stats := dict "total" 0 }} {{- range $pages.GroupByPublishDate "2006" }} {{- if ne .Key "0001" }} {{- $stats = merge $stats (dict "total" (add $stats.total (len .Pages))) }}
{{- replace .Key "0001" "" }} {{ len .Pages }} articles
{{- range .Pages }} {{- if eq .Kind "page" }}

{{- .Title | markdownify }} {{- if .Draft }}[draft]{{- end }}

{{- if .Params.tags }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if gt $stats.total 0 }}
{{ $stats.total }} Total Articles
{{ len ($pages.GroupBy "Section") }} Sections
{{- end }} {{- end }}{{/* end main */}}