{{ define "main" }}

{{ .Content }}

{{- /* The homepage should show only pages from the given sections (with `$.Site.Params.mainSections`).
Otherwise, we take the pages of a section. */ -}}
{{ $pages := .Pages }}
{{ if .IsHome }}
{{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
{{ end }}

<main class="posts--list">
{{- $paginator := .Paginate $pages }}
{{- range $paginator.Pages }}
<article class="post--list">
    <time class="post--list__date" datetime="{{ .PublishDate.Format "2006-01-02" }}">{{ .PublishDate.Format "2006-01-02" }}</time>
    <a class="post--list__title" href="{{ .RelPermalink | relURL }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
</article>
{{- end }}
</main>

{{ if $paginator.HasNext }}
  <p style="margin: 1em;">
    <a href="{{ "/archives" | relLangURL }}">View all posts</a>
  </p>
{{ end }}
{{- end }}

