Hey all. I’ve looked over pagination code via Google, blog posts, and through this forum and I can’t seem to find an answer to a simple problem. All I want is for the paginated pages to have the newest (by date) on the first page, and have the oldest content on the last page.
{{ define "content" }}
<main class="notes">
{{ $posts := where .Site.RegularPages "Section" "notes" }}
{{ $paginator := .Paginate $posts.ByDate.Reverse }}
<header>
{{ .Content }}
</header>
{{ range $paginator.Pages }}
{{ $t := .Date }}
{{ $t = time.AsTime $t }}
{{ $format := "Jan 02, 2006" }}
<article class="note">
<a href="{{ .Permalink }}">
<time>{{ $t.UTC.Format $format }}</time>
</a>
{{ .Content }}
</article>
{{ end }}
<footer>
{{ partial "pagination.html" . }}
</footer>
</main>
{{ end }}
I’ve played around with the contents of $posts :=, $paginator :=, and the range lines in various combinations using .ByDate, .ByPublishedDate, and .Reverse with no luck in actually getting it to render in reverse chronological order. What am I missing?
I also have disableAliases set to true, if that matters at all.