website/layouts/_default/archives.html

29 lines
1.0 KiB
HTML

{{- define "main" -}}
<main>
<h1>{{ .Title }}</h1>
{{ .Content }}
{{- /* Creating a section that lists out regular pages by year */ -}}
{{ range $.Site.RegularPages.GroupByPublishDate "2006" }}
{{- /* Skip regular pages with an invalid creation date string. */ -}}
{{- /* This is convenient if we want to exclude certain posts to be listed by giving no value to `date` in the frontmatter. */ -}}
{{- /* We will also exclude hidden pages. */ -}}
{{ if ne .Key "0001" }}
<section data-year="{{ .Key }}">
<h2 id="{{ .Key }}">{{ .Key }}</h2>
<ul class="posts--list">
{{- range .Pages -}}
<li class="post--list">
<date class="post--list__date">{{ .PublishDate.Format "2006-01-02" }}</date>
<a class="post--list__title" aria-label="{{ .Title }}" href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{- end -}}
</ul>
</section>
{{- end }}
{{ end }}
</main>
{{- end -}}