hugo-WonderMod/layouts/_default/list.html

45 lines
1.5 KiB
HTML
Raw Normal View History

2018-01-08 11:28:39 -05:00
{{ partial "header.html" . }}
{{ if not .IsHome }}
<header class="list-header">
{{ if eq .Data.Singular "tag" }}<span>Tagged in</span>
<h1 class="list-title">{{ .Data.Term }}</h1>
{{ else }}<h1 class="list-title">Posts</h1>
{{ end }}
</header>
{{ end }}
{{ $paginator := .Paginate (where .Pages ".Params.type" "!=" "page") (index .Site.Params "paginate" | default 10) }}
{{ if gt $paginator.TotalPages 0 }}
{{ range $index, $page := $paginator.Pages }}
{{ if and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) }}
{{ .Scratch.Set "postClass" "first-entry" }}
{{ .Scratch.Set "firstEmoji" "<span class=\"welcome-emoji\">👉</span>" }}
{{ else }}
{{ .Scratch.Set "postClass" "post-entry" }}
{{ end }}
<article class="post {{ .Scratch.Get `postClass` }}">
<header class="post-header">
{{ safeHTML (.Scratch.Get `firstEmoji`) }}
<h2 class="post-title">{{ .Title }}</h2>
</header>
<p class="post-summary">{{ .Summary | plainify | htmlUnescape }}...</p>
<footer class="post-footer">
<p class="post-meta">{{ .Date.Format "2006.1.2" }}</p>
</footer>
<a class="post-link" href="{{ .Permalink }}"></a>
</article>
{{ end }}
{{ end }}
{{ if gt $paginator.TotalPages 1 }}
<footer class="list-footer">
<nav class="pagination">
{{ if $paginator.HasPrev }}
<a class="pagination-prev" href="{{ $paginator.Prev.URL }}">← Prev Page</a>
2018-01-08 11:28:39 -05:00
{{ end }}
{{ if $paginator.HasNext }}
<a class="pagination-next" href="{{ $paginator.Next.URL }}">Next Page →</a>
2018-01-08 11:28:39 -05:00
{{ end }}
</nav>
</footer>
{{ end }}
2018-07-05 14:45:58 -04:00
{{ partial "footer.html" . }}