Homepage is broken after upgrading (0.20 -> 0.58)

Hello,
I have a website that I had not maintained for a while. It was made with hugo 0.20, back in 2017, but now I would like to port it to the current release, 0.58.3.

After generating the files, I noticed that almost everything is more or less the same, but the home page is definitely broken: the content of the homepage is there, but it is as if the layout is not used anymore.

The source code of the website is here, if you want to inspect it or try compilation by yourself: https://github.com/pigreco-luogoideale/hugo-site

It is likely that this problem is due to the page bundles introduced in 0.32, but I am unable to understand what is causing the issue.

As you can see, I have no themes installed and I am using just the layouts directory. In there, I have index.html that should use partial templates for header and footer, and the content/_index.html should use that layout.

I would like to understand how to fix it and why the issue is arising: in my content directory I have no other files besides markdown and html page files, so I think bundles should not even be considered.

Thanks and best regards!

EDIT:
I previously found this issue, but I am unable to see if that is my case.

Try putting blank front matter at the start of /content/_index.html (i.e. two lines of +++).

At the moment, hugo is thinking it should just dump the content of /content/_index.html as your siteā€™s /index.html rather than using the layout defined in /layouts/index.html.

Iā€™ve cloned your site and done this, and your front page now looks much better.

2 Likes

Thanks a lot, the problem seems indeed solved!

Now, two follow up questions for you :slight_smile:

  1. how do you know that hugo was ignoring the layout? (I mean, besides observation :D)
  2. is there a ā€œexplainingā€ or ā€œtracingā€ mode, that shows what hugo is searching/taking into consideration when compiling pages?

Thanks a lot!

The troubleshooting process was

  1. Looked at the code of your repository.
  2. I hadnā€™t seen anyone use /content/_index.html before (Iā€™m used to /content/_index.md), so I went to the docs to see how .html files are processed in hugo (cause I know that they can be usedā€¦Iā€™ve just never done it that way)
  3. Found the third paragraph under Supported Content Formats (which I think is almost the only thing said about html files for content). Which explains how hugo interprets the content of .html files.
  4. Had a hunch that since your _index.html wasnā€™t a full webpage (no <html><head> tags) that you probably meant for it to be processed through a layout. So guessed it needed frontmatter.
  5. Cloned your repository, had a look at what the output was ā€˜as isā€™, then put in the blank frontmatterā€¦and it worked.

As for your second question - you could try running in verbose modeā€¦which displays lots of information.

1 Like

Ok, thanks. I was not aware that content pages needed a front matter to ā€œtriggerā€ the usage of a layout. I thought that would have been used anyway, as long as the layout structure was appropriate for the contents.

I tried verbose, but it is still not what I am looking for.

Thanks a lot!