mirror of
https://github.com/foo-dogsquared/hugo-theme-contentful.git
synced 2025-01-31 04:58:03 +00:00
86346b1af1
It's better for three reasons: * It is a predefined frontmatter variable from Hugo. * When unset, it is basically the '.Date'. * More specific and the 'date' variable can now be assigned for the creation date.
35 lines
1.2 KiB
HTML
35 lines
1.2 KiB
HTML
{{ define "main" }}
|
|
<hr>
|
|
{{ .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 }}
|
|
|
|
{{ range (.Paginate $pages).Pages }}
|
|
<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>
|
|
</article>
|
|
{{ end }}
|
|
|
|
{{ partial "pagination.html" (dict "Paginator" .Paginator "activeNumberOfPages" 2) }}
|
|
{{ end }}
|