I came across @Raymond_Camden blog on the pagination issue while learning pagination in Hugo by working with this index.html
for a Hugo homepage which lists all content/posts/
. I would like to paginate it to the last 10.
- I have added a pagination value in the config.toml
paginate = “10”
- I have deleted /public folder to purge stale pages.
What could I be missing because the pagination is not working? If you want to see an actual website running this, check https://ar.al/
{{ .Content }}
<!-- Group by year. -->
{{ range .Site.RegularPages.GroupByDate "2006" }}
<h2>{{ .Key }}</h2>
<!-- Group by month. -->
{{ range .Pages.GroupByDate "January 2006" }}
<h3>{{ .Key }}</h3>
<!-- Orders content according to the "date" field in front matter. -->
{{ range .Pages.GroupByDate "02" }}
<h4 class='postdate date'>{{ .Key }}</h4>
<ul>
{{ range $index, $post := .Pages }}
<li>
<time datetime="{{ $post.Date.Format "2006-01-02T15:04:05Z0700" }}">
<span class='postdate day item-{{ $index }}'>{{ $post.Date.Format "Mon" }}</span>
</time>
<span class='postdate'>{{ $post.Date.Format "15:04" }}</span>
<a class='posttitle' href="{{ .RelPermalink }}">{{ $post.Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}
{{ end }}
{{ end }}
{{ partial "footer.html" . }}
</body>
</html>