Hugo No Layout File Error
Last updated: Jul 3, 2022
I set up a new work environment on a new machine. I wanted to do some blogging, so I did a git clone
of my blog repo, wrote a quick article, and started up hugo server
. But when I opened the dev URL, I was presented with a blank page. Weird, did I break my site?
I took a look at the hugo server log and noticed this error:
WARN 2022/07/03 19:37:17 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
Hmm, no layout file? Well, what provides layouts for my blog? The theme does. And how do I get my theme? Through a git submodule!
When setting up my new environment, I forgot to pull in my theme through the git submodule.
Let’s fix that:
git submodule init
git submodule update
The submodule was initialized and updated successfully.
After stopping and starting the server again, everything loaded correctly. Always remember to pull your submodules!