I know I am not supposed to use them…

I love static sites, and I run this one with Hugo – it’s awesome. Anyways, the way I add the theme to the site is by including the git repo of the theme in the repo that tracks this site. It is not just dropped in mess with all the git configurations. It is added as a git submodule to mess with all the git configurations. I have read countless articles, and have has first hand expierence, about how submodules are usually not worth the headache. I had to re-learn that lesson again today.

After trying to get back into posting on the blog I was trying to see some changes locally before I pushed to my dev branch. I have the dev branch automatically building on Netlify but I wanted a “cleaner” git history so I wanted to see my unstanged changes locally. So I fired up the server on my hugo install:

hugo -D server
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2021/04/04 21:42:24 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

The -D will build the drafts so I can see unpublished posts.

After seeing a bunch of “warnings” (I assumed there might be some issue because I am running locally) I was presented with a blank page… I assumed that server was not working. I am running the server via wsl and trying to get to it from my windows desktop targeting localhost:1313. So I tried a few different browsers – nothing. Then I tried running nc from the wsl terminal:

ramon@-$ nc localhost 1313

HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
Connection: close

400 Bad Request
ramon@-$

So I can confirm that the server is, in fact running, and that it was responding and serving something. So I then moved to my windows desktop and attempted a telnet. At first I got an error, and then realized that I needed to “enable” telnet: windows features telnet

After a short wait I had good ole telnet and was able to run open localhost 1313 telnet

At this point I am thinking there is just some problem with hugo. After enableing more logging by passing the -v flag to the hugo server command it finally hit me that I am just seeing a blank page because the site cannot be rendered properly and that is handled by the theme. To test out this theory I enabled another theme by updating the config.toml

# theme = "hello-friend-ng"
theme = "ananke"

And then made sure to add the theme to my repo:

git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke

As soon as I saw the new theme next to my original one, I knew something was up… The new theme had files in the directory, and mine was empty… After launching the hugo server again, I was no longer presented with a blank page at localhost:1313. Finally I realized that I had a directory that was supposed to be a submodule and all the files were missing. So I just checked around realy quick on how to run a “git pull” on a submodule and found this:

git submodule update --init --recursive

No luck, still no files. So I said forget it, I will just delete the folder and then recreate the submodule. This led to new problems becasue that directory was being tracked by git as a submodule. I didn’t want to commit any of this and futher pollute the history. The next step was to check the index with ls-files. This turned out to do the trick for me.

git ls-files -- themes/

This showed the directory! At that point I just removed it with:

git rm themes/hello-friend-ng

Finally I was able to add it back

git submodule add https://github.com/rhazdon/hugo-theme-hello-friend-ng.git themes/hello-friend-ng

Hopefully putting this info on the blog will help me get to it faster, because I just added the submodule back to my repo :).