hugo-theme-contentful/layouts/_default/list.html
Gabriel Arazas 059a6c489c Improve the UX of the theme
Also, this is enough for a minor release.
2020-10-28 02:06:16 +08:00

36 lines
1.3 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 (where (.Paginate $pages).Pages "Params.hidden" "!=" true) }}
<article class="post">
<h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
<div class="post__meta">
<span>
<time datetime="{{ .Date }}">
{{ .Date.Format "2006-01-02" }}
</time>
{{- if and .GitInfo (ne (.Date.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
(<time datetime="{{ .Lastmod }}">{{ .Lastmod.Format "2006-01-02" }}</time>)
{{- end }}
</span>
{{- /* 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 }}