I run another blog that is built using Hugo using the "personal-site" theme.
Basically, I use "sections" to create custom lists of posts on that blog. However, they weren't paginating with this theme.
I found a way to make it happen.
I created a section with a _index.md
file in a subdirectory, however, pagination wasn't working.
The initial content of the layouts/_default/list.html
is:
{{ define "main" }}
{{ partial "hero" . }}
<div class="feed">
{{- if .Content }}
<div class="page block">
{{ with .Content }}<div class="page__content{{ if not $.Title }} page__content--notitle{{ end }}">{{ . }}</div>{{ end }}
</div>
{{- end }}
{{ range .Pages }}
{{ .Render "summary" }}
{{ end }}
</div>
{{ partial "pagination.html" . }}
{{ end }}
I change the line {{ range .Pages }}
to {{ range .Paginator.Pages }}
and then added Paginate = 5
in the config.toml
file:
baseURL = "https://example.org/"
languageCode = "en-us"
title = "my blog"
theme = "personal-site"
summaryLength = 10
uglyurls = true
toc = false # Enable Table of Contents
canonifyURLs = true
Paginate = 5
That's it!
I hope someone else finds this useful.
Comments
comments powered by Disqus