{{ define "main" }} {{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }} {{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }} {{ $PageContext := . }} {{/* Once either .Paginator or .Paginate is called while generating a page, its result is cached, and any subsequent similar call will reuse the cached result. So we define $pages instead of $paginator (using .Paginate) to avoid confusion. */}} {{ $pages := $PageContext.RegularPages }} {{ if .IsHome }} {{ $PageContext = .Site }} {{ $pages = where $PageContext.RegularPages "Type" $contentTypeName }} {{ end }}
{{ range (.Paginate $pages).Pages }} {{ end }}
{{ partial "pagination.html" . }}
{{ end }}