website/layouts/posts/list.html

29 lines
873 B
HTML
Raw Normal View History

2020-11-06 16:16:16 +00:00
{{ define "main" }}
2020-11-06 16:16:16 +00:00
{{ .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 }}
2020-11-06 16:16:16 +00:00
<main class="posts--list">
2020-11-06 16:16:16 +00:00
{{- $paginator := .Paginate $pages }}
{{- range $paginator.Pages }}
<article class="post--list">
2021-02-01 04:34:15 +00:00
<time class="post--list__date" datetime="{{ .PublishDate.Format "2006-01-02" }}">{{ .PublishDate.Format "2006-01-02" }}</time>
2023-05-03 07:39:51 +00:00
<a class="post--list__title" href="{{ .RelPermalink | relURL }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
</article>
2020-11-06 16:16:16 +00:00
{{- end }}
</main>
2020-11-06 16:16:16 +00:00
{{ if $paginator.HasNext }}
<p style="margin: 1em;">
<a href="{{ "/archives" | relLangURL }}">View all posts</a>
</p>
{{ end }}
{{- end }}