List page confusion

I think I configured myself into a corner here.

While experimenting on another idea/issue I realized that my list template is never loaded (in the normal flow of my site).

Expected behaviour:
Loading my domain uses the _default/home.html or _default/index.html template (I tried both)
Clicking in the pagination will lead to /page/2/ and load the _default/list.html template

What’s happening:
Clicking the pagination loads /page/2/ but uses the _default/home.html template (or index.html).

Loading http://localhost:1313/post/ loads the list.html template with subsequent pagination to that template.

That basically means I have two list pages each, one with post in the slug, one without. Double content. Bad SEO. Google angry :wink:

Is there a way to tell Hugo to use for subsequent listing pages AFTER the homepage (page 2 and following) the list.html template? I do not want the post in my URL because I am using only posts.

Should I move the content of my posts content folder (/year/month/page bundles) one level up? That would as far as I understand create even more sections?


I guess I could use some kind of {{ if .IsHome }} this {{ else }} that {{ end }} construct and delete the list.html file. But that would cause errors about not found list templates?

put the home page template to layouts/index.html

You can use --debug to see what hugo is looking for.

Hi @ju52, I think you misunderstand my problem (or I am mis-stating it). I HAVE layouts/index.html (I have tried it in all location that is searched for according to the lookup table in the documentation.

My problem is, that home.html is “greedy” in sense of:

  • I have the last 5 entries on it and a pager.
  • The pager links to /page/2/ and uses the index.html template (same as above).

I would have expected that it links to /page/2/ and uses the list template from there on. With home.html being only and without paging used for the first page, not sub pages. (/page/2/ being a subpage in my conception).

While writing this I realize, that the system does not know what I am paging - it could be all pages or some section pages… I think I will start from there trying to find a way. And until then /post/page/2/ is redirected by headers so Google doesn’t find it.

some ideas to continue

You can config pagination

If Google should not find the pages, make it headless …
Sometimes robots.txt helps

you can create / modify a pagination.html partial