V0.55.x can't find homepage layouts

Ever since upgrading to 0.55.x (I’ve tried nearly every minor version) hugo can no longer find a template for my home page and only renders the small bit of content thats in my _index.md file. Reverting back to 0.54.x solves the issue for me.

My theme has a index.html file in its layouts directory that used to be used, moving this into _default or to something like home.html doesn’t make Hugo discover it either. The warning I’m presented with upon running hugo server and trying to navigate to my home page is:

WARN 2019/05/27 17:16:57 found no layout file for "HTML" for "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2019/05/27 17:16:57 found no layout file for "RSS" for "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2019/05/27 17:16:57 found no layout file for "headers" for "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2019/05/27 17:16:57 found no layout file for "redirects" for "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

The headers and redirects warnings are because I have some Netlify ones setup (taken from the Netlify tutorial on the Hugo website) and they’re also broken after upgrading, in 0.54.x they work fine. Any other page (list, single etc) all render fine, its just the homepage which isn’t working.

The layouts folder looks like this:

layouts/
├── index.headers
├── index.redirects
├── partials
│   └── posts
│       └── comments.html
└── shortcodes
    └── github_file.html

And the theme setup is…

themes/
└── jloh
    ├── LICENSE.md
    ├── archetypes
    │   └── default.md
    ├── layouts
    │   ├── 404.html
    │   ├── _default
    │   │   ├── baseof.html
    │   │   ├── list.html
    │   │   ├── single.html
    │   │   └── terms.html
    │   ├── index.html
    │   ├── partials
    │   │   ├── footer.html
    │   │   ├── header.html
    │   │   ├── meta.html
    │   │   ├── navigation.html
    │   │   ├── posts
    │   │   │   ├── author.html
    │   │   │   ├── card.html
    │   │   │   ├── comments.html
    │   │   │   ├── next.html
    │   │   │   ├── subscribe.html
    │   │   │   └── tag-link.html
    │   │   └── schema.html
    │   └── posts
    │       ├── list.html
    │       └── single.html
    ├── static
    │   ├── css
    │   └── js
    └── theme.toml

I’ve also published the website temporarily on GitHub if it helps debug! Any help would be fantastic.

No there is an ERROR in the console as soon as I test the repo:

Error building site: failed to render pages: render of "taxonomy" failed: "/home/alex/Desktop/netlify-redirect/themes/jloh/layouts/_default/baseof.html:12:51": execute of template failed: template: _default/list.html:12:51: executing "_default/list.html" at <index .Site.Data.css.hash "main.css">: error calling index: index of untyped nil

The ERROR refers to this line in the baseof.html template
<link rel="stylesheet" href="{{ print "css/" ( index .Site.Data.css.hash "main.css" ) | relURL }}" />

But there is no such file called main.css in the provided repo as far as I can tell.

Also I noticed that there is a SCSS file under src/main.scss

I don’t know what is the setup of your theme but you need to provide the CSS file from your custom pipeline for Hugo to generate your site.

Also in case you don’t know Hugo has support for Assets Management through Hugo Pipes. See:

Also it looks like that you need to edit the GULP settings for the gitignore file of the repo because right now all CSS/JS assets are ignored.

Apologies, I’ve updated the repo to contain the built assets for easier debugging!

Yeah, I’m finally getting back around to porting this website over to Hugo from Ghost. When I first started pipes wasn’t a thing.

Another thing to note is I have a very similar setup current running on this site which seems to work fine. The only major difference is that all the layouts aren’t in a theme but just in the layouts directory.

I encountered more problems while debugging your project.

All png images under /static/ are corrupted. I got the following error:

execute of template failed: template: partials/schema.html:19:10: executing "partials/schema.html" at <imageConfig (printf "static/%s" .Site.Params.logo)>: error calling imageConfig: image: unknown format

I tried running optipng --fix *.png under /static/images/2017/08 but nothing got fixed:

** Processing: android-chrome-192x192-jloh-1.png
Error: Unrecognized image file format

** Processing: android-chrome-192x192-jloh.png
Error: Unrecognized image file format

Anyway I had to delete your entire schema.html partial to get on with debugging.

Basically you have not included any front matter in your file under /content/_index.md and as a result the only thing that got rendered was the HTML contents of that file.

Don’t know how it was possible for your homepage to render properly in Hugo 0.54 but as far as I know front matter is mandatory in content files.

So just add some proper front matter parameter to _index.md and the homepage will look as intended.

1 Like

Legend! Thanks so much, thats fixed it in one.

The png files being corrupted are because they’re git LFS assets and I’m guessing just the pointer downloaded.

Thanks agian for helping me!

This is the critical sentence – helped me solve the problem as well. Just pointing it out here because the lines that are quoted under the top post all refer to the seemingly corrupt png images, but it’s really the missing front matter that prevents the home page from being rendered. In my case, I simply added

---
---

at the top of my content/index.html file.