hugo-theme-contentful/layouts/_default/list.html

35 lines
1.2 KiB
HTML
Raw Normal View History

2019-09-20 16:11:12 +00:00
{{ define "main" }}
<hr>
2020-05-12 08:31:55 +00:00
{{ .Content }}
2019-09-20 16:11:12 +00:00
2020-10-21 03:28:02 +00:00
{{- /* The homepage should show only pages from the given sections (with `$.Site.Params.mainSections`).
Otherwise, we take the pages of a section. */ -}}
2019-09-20 16:11:12 +00:00
{{ $pages := .Pages }}
{{ if .IsHome }}
{{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
{{ end }}
2020-10-21 03:28:02 +00:00
{{ range (.Paginate $pages).Pages }}
2019-09-20 16:11:12 +00:00
<article class="post">
<h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
<div class="post__meta">
<time datetime="{{ .PublishDate }}">
{{ .PublishDate.Format "2006-01-02" }}
</time>
{{- if and .GitInfo (ne (.PublishDate.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
<time datetime="{{ .Lastmod }}">{{ .Lastmod.Format "2006-01-02" }}</time>
{{- end }}
{{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}}
{{ with .Params.author }}
{{ $author := index (first 1 .) 0 }}
<span data-authors="{{ jsonify . }}">{{ $author.name }}{{ if ge (len .) 2 }}, et al.{{ end }}</span>
{{ end }}
</div>
2019-09-20 16:11:12 +00:00
</article>
{{ end }}
{{ partial "pagination.html" (dict "Paginator" .Paginator "activeNumberOfPages" 2) }}
2020-05-09 07:19:04 +00:00
{{ end }}