Index and post/page list not rendering theme but actual posts/pages are

Hi all,

I had not touched my Hugo version in quite a few years (0.24.x), finally bumped up to latest (0.89.x), and my custom theme broke.

When I go to the main index page, I just see a list that says “posts, pages, json”, each of which is clickable. Clicking the pages also brings me to a list of the correct pages for each type, but no proper formatting. When I click on the actual page or post, it renders correctly.

From looking at the rendered index.html or post lists, it looks as if it simply has ignored the theme (or most of it).

I assume my custom theme has got something wrong, but I am not sure what or how to find it. hugo returns an exit code of 0, so that is fine, and running hugo --debug does not give any indications of a problem.

I am doing this both locally and on netlify. FWIW, the full rendered site is here https://618e54e3d1675e6cc5ad5163--blog-atomicinc.netlify.app , and the source is here GitHub - atomicinc/hugoblog: My blog on Hugo

Is there any way for me to have hugo tell me what is upsetting it?

Thanks in advance

A lot has changed in four and a half years. If it were me, I would start over with a theme that is current. I’m sure others have suggestions, but I would start with Ananke.

If you are dedicated to fixing what you have:

  1. Review the template lookup order. This is the primary problem with your site. It is not using the same templates that it was with v0.ancient.0.

  2. A content type named page can be… messy. Currently the home page is using src/themes/atomic-2016/layouts/page/list.html instead of src/themes/atomic-2016/layouts/index.html because the home page has .Type = page. Maybe change the page directory to pages, change the name of the corresponding template directory to match, and then search and replace in your markdown to adjust the links.

  3. Audit your site. See https://discourse.gohugo.io/t/35184.

  4. Consider using base and blocks to provide a common shell for all your templates.

LIke I said, if it were me, I’d start over with a clean and modern baseline.

Thanks @jmooring

A lot has changed in four and a half years

Haha, I bet it has. I started by looking at changelogs, realized I would go crazy before I figured out what was broken.

If you are dedicated to fixing what you have:

I want the same styling and flows, more or less. If the path of least resistance is to rebuild it using a current them, I will go for it; if it is to fix the current, I will go for that too. No religious attachments either way, just minimal pain. :slight_smile:

I will see what I can do. Thanks for jumping in.

1 Like

By the way,

v0.ancient.0

:grin:

1 Like

@jmooring is there any sort of “build and debug” mode, where you can tell it to render the whole site, or even better just one page, and have it split out what rendering process it went through?

The audit didn’t give any material errors (9 individual pages with issues, none of them relevant to the core problem), and I couldn’t see an issue with the layout order; it should go to layouts/index.html for the home page, so it either is not doing it, or something inside it is broken.

I sort of went down both paths, seeing what it would take to fix what I already have (which is hard, as I still don’t know the issue breaking some pages), and adapting your recommended template (which requires learning a whole new system in order to get my desired navigation menu, fonts, search, look, images, etc.). Not sure which will be less pain.

No, there is not, though you could create your own by adding warnf statements as you enter/exit each template.

See my previous comment about your directory structure. The problem One of the problems is caused by naming the directory “page”.

The problem is caused by naming the directory “page”.

So I see. I couldn’t tell that from reading the layout description or output (I do wish it had given me an error so I didn’t have to bother you).

Fixing that - and a few other things - fixed the site on the spot, so I can get it working. Now I can take some time to try and convert it to the newer format.

Thanks again

2 Likes