website/layouts/_default/list.html
2022-11-22 23:09:33 +08:00

29 lines
847 B
HTML

{{ 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 }}
<ul class="posts--list">
{{- $paginator := .Paginate $pages }}
{{- range $paginator.Pages }}
<li 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="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
</li>
{{- end }}
</ul>
{{ if $paginator.HasNext }}
<p style="margin: 1em;">
<a href="{{ "/archives" | relLangURL }}">View all posts</a>
</p>
{{ end }}
{{- end }}