List.html build oddness

Just recently I’m finding that one of my pages isn’t building correctly. It’s almost like a list.html is trying to render as a single.html. I cannot figure out what is going wrong.

The odd thing is that if I delete the template that isn’t being generated so that _default/list.html is used instead I get exactly the same issue. So for the moment I’m going to discount my custom list template as the problem. I will describe the setup for background though.

So, I have a directory in content called committee. This has an _index.md in it which just has frontmatter. In the committee directory I have a directory for each committee member and in each of those directories I have an index.md and an image. The custom list template I have in layouts/committee/list.html iterates over the pages (i.e. committee members) and creates a table with their image, name, email address, etc. It’s actually pretty simple and has worked well for a couple of years.

As mentioned above I’ve removed my template which creates the table so that _default/list.html is used and what I see when I run live locally is a random committee member name and email address. This implies that my committee/list.html is actually trying to behave as if it were a committee/single.html, which is really odd. If I then go into _default/list.html and save that file (with zero changes) the page instantly refreshes and it renders exactly as expected, i.e. a list of links to the committee pages. I see the same behaviour when I reinstate my custom committee/list.html. Start the server and see a random committee members name, hit save on committee/list.html with a tiny change and it renders as expected.

This really odd and I can’t figure out what’s happening.

I’ve been continuing to dig into this and specifically looking at why my committee page is the only one that isn’t rendering correctly when I spotted this in my config.toml:

[permalinks]
  members = '/members/:title'
  committee = '/committee'

I couldn’t remember why I’d added that committee = '/committee' line so I removed it, and now that committee page is rendering correctly. Both local live server and also when I build the full site ready for publication, all appears to be working.

Why might the addition of that config entry now be causing a problem?

Did anything change “just recently”? For example, did you upgrade your theme or Hugo?

What is in the front matter?

“Random” is an indication of a page collision, a concurrency problem, or perhaps caching when you shouldn’t be.

It could be related to a page collision, which you can detect by building with the --printPathWarnings flag.

Without access to your project I can only guess, which isn’t terribly efficient.

Only thing that has changed recently was a weekend of hacking to stop using image file names and switch to using EXIF. That hasn’t changed anything to do with this page, nor the templates involved.

Frontmatter looks like this:

---
title: Club Committee
date: 2021-09-04T15:53:46+01:00
draft: false
menu:
  main:
    parent: Info
    name: Who's Who
    weight: 7
---

I agree that “random” would indicate these issues. Only thing is that I don’t do any of that. The build seems to get halfway through a build and then gives up sometimes. Other times it will just render incorrectly. Well, it didn’t before I removed the config entry, now it works.

printPathWarnings didn’t indicate any issues.

I’ll keep digging.