Index page broken

Hello - after starting to use this version:

Hugo Static Site Generator v0.58.3-4AAC02D4/extended darwin/amd64 BuildDate: 2019-09-19T15:33:56Z

…against this repo for my site at https://logr.cogley.info, I find that the top index page is broken and I wanted to ask for help since I am not finding what is wrong.

When I run hugo server like this using verbose:

hugo server --navigateToChanged --buildDrafts --buildFuture --watch --verbose

… I just get this error:

INFO 2019/09/30 13:25:58 postcss: use config file /Users/rcogley/dev/logr.cogley.info/postcss.config.js
Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`

… but nothing about templates etc. I tried running the recommended npm update but, the error keeps appearing.

I tried editing my /layouts/index.html to make its pagination code closer to what’s in the docs.

https://git.sr.ht/~rickcogley/logr.cogley.info/commit/master

Additionally I added <span>{{$paginator.TotalPages}}</span> to my index template as a sanity check, but it returns 1. I have a bunch of content on this site, so this should be showing several pagination pages of 20. Well, at least there were several pages’ worth before I upgraded hugo.

I’m sure I’m missing something … appreciate any help anyone might give, thanks.

To fix the empty index page replace line 9 of layouts/index.html with:
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "posts") }}

For background about this breaking change have a look at this GitHub issue also this is mentioned in the release notes of Hugo v.0.57.0

2 Likes

Thanks very much, that gives me a starting point to check for that deprecated code. Appreciate it!

1 Like

mostly the paging should be within a section

{{ $paginator := .Paginate .CurrentSection.RegularPages }}

This issue is about the homepage of a project.

It’s just a super simple micro blog, where I’m running a script to generate a post, then another to deploy the post and tweet. I have some frontmatter in each post but, it’s autogenerated and just ignore-able. The url path looks like /2019/09/30/1569800039/. Just wanted the pagination on the top page.