list.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {{ partial "header.html" . }}
  2. {{ $pctx := . }}
  3. {{ if .IsHome }}
  4. {{ $pctx = .Site }}
  5. {{ else }}
  6. <header class="page-header">
  7. <h1>{{ if eq .Data.Singular "tag" }}{{ .Data.Term }}{{ else }}Posts{{ end }}</h1>
  8. </header>
  9. {{ end }}
  10. {{ $paginator := .Paginate (where $pctx.RegularPages "Type" "in" .Site.Params.mainSections) }}
  11. {{ if gt $paginator.TotalPages 0 }}
  12. {{ range $index, $page := $paginator.Pages }}
  13. <article class="{{ if and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) }}first-entry{{ else }}post-entry{{ end }}">
  14. <header class="entry-header">
  15. <h2>{{ .Title }}</h2>
  16. </header>
  17. <section class="entry-content">
  18. <p>{{ .Summary | plainify | htmlUnescape }}...</p>
  19. </section>
  20. <footer class="entry-footer">
  21. <time>{{ .Date.Format "January 2, 2006" }}</time>
  22. </footer>
  23. <a class="entry-link" href="{{ .Permalink }}"></a>
  24. </article>
  25. {{ end }}
  26. {{ end }}
  27. {{ if gt $paginator.TotalPages 1 }}
  28. <footer class="page-footer">
  29. <nav class="pagination">
  30. {{ if $paginator.HasPrev }}
  31. <a class="prev" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a>
  32. {{ end }}
  33. {{ if $paginator.HasNext }}
  34. <a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a>
  35. {{ end }}
  36. </nav>
  37. </footer>
  38. {{ end }}
  39. {{ partial "footer.html" . }}