Pagination fails after listing posts


After modifying the theme and fix the problem I had I get another related with pagination.

As I sad, when listing the posts at the homepage, everything seems fine and posts can be accessed going through the link. But, when going to page 2, it returns a 404 error.

The theme I’m talking about is at

I may put something wrong, but I don’t know what.

Thank you!

The theme certainly doesn’t throw a 404 error when accessing page 2 in its list pages as is shown in the demo on the Hugo Themes website:

You need to show us the source code of your project and also the link to your published website would be helpful.

It seems that something is wrong with your setup and not the theme.

The source code is linked at a repository in the main post, just clone it and setup the theme in the config file. Also, the config file of my site is copy and paste with the exampleSite/config.toml at my repository.

I linked a post where I had another problem I fixed, and because of that, I don’t have pagination.

I don’t have the computer in front of me right now, but I’ll upload it as soon as I can. Meanwhile, if you have a Hugo site (local, not online, of course), you may try my modified theme :slight_smile:


So I executed git clone as per your request and tested the exampleSite locally.

Everything works fine on my end. i.e. http://localhost:1313/page/2/ and http://localhost:1313/post/page/2/

This theme requires a /post/ section for its pagination. See line 6 of _default/layouts/list.html: {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}

If you use a different section then you may have problems.

But I cannot guess further. If you still have problems as I said above you need to share the source code of your project.

I don’t understand what you mean by “share your source code”. Literally I just typed hugo new site blog, put some posts at content/post/, copy the config.tom from exampleSite to my blog’s root, and ran hugo. The blog compiles, but getting to /page/2 get me a 404 error…

The $paginator is added by me. I couldn’t filter by posts and pages are listed too, so it’s more like a filter.

There is a big pink banner at the top of this forum that points to this topic:

Beyond that I cannot guess what is wrong with your setup without seeing the project.


After testing the source of your website (that you sent me in private) I found what is causing problems with the Pagination.

In line 67 of your config.toml you have the following parameter:
home = [ "RSS", "HTML"]

The order of Output Formats matters.

Reverse what you have and then the .Paginator next and prev navigation links will output HTML.
i.e. home = [ "HTML", "RSS" ]

Incidentally this the second time today that I am seeing this setup.

Can you please tell me where did you get the idea about entering the RSS Output Format first?

I didn’t know (or I didn’t read in the doc correctly).

I got from here looking for a thing for the rss.xml file to render my feed.

I’ll test it and will mark the post as solved :slight_smile:

Thank you for your time and your help, @alexandros :slight_smile: