mirror of
https://github.com/foo-dogsquared/hugo-theme-contentful.git
synced 2025-01-31 04:58:03 +00:00
3bfcecb51c
As much as I avoid creating custom partials, it seem it is not possible with this component since it has gotten a bit bigger than I expected. The pagination component is a modified version of the internal pagination template but smarter. One of the major change is it will only apply ellipses if it has more than one page to skip. Also, it is easier to configure now that it is refactored to be one. Last but not least, it has comments. :)
21 lines
713 B
HTML
21 lines
713 B
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">
|
|
<a href="{{ .Permalink }}" aria-label="{{ .Title }}"><h1>{{ .Title }}</h1></a>
|
|
<date datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</date>
|
|
</article>
|
|
{{ end }}
|
|
|
|
{{ partial "pagination.html" (dict "Paginator" .Paginator "activeNumberOfPages" 2) }}
|
|
{{ end }}
|