Hugo: Fix git bug when installing a repo with a theme

Posted on Sat 28 May 2022 in Other

بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ

If you have tried installing a repo from GitHub/GitLab or any other git host that is a Hugo project with a theme, a bug may appear that has the following error:

WARN 2022/05/22 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 2022/05/22 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 2022/05/22 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

This bug can be reproduced by doing the following:

git clone https://github.com/colmjude/hugo-data-template-tutorial

And then trying to run the project using Hugo:

cd hugo-data-template-tutorial

hugo server -D

This bug will cause blank pages to appear when running the server, as the theme is missing from the project.

This can be fixed by doing the following:

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

Or alternatively by using the recurse-submodules command when cloning:

git clone --recurse-submodules https://github.com/colmjude/hugo-data-template-tutorial


If you don't know how to use RSS and want email updates on my new content, consider Joining my Newsletter

The original content of this blog is a Waqf solely for the Pleasure of Allah. You are hereby granted full permission to copy, download, distribute, publish and share this content without modification under condition that full attribution is given to this author by creating a link either above or below the content that links back to the original source of the content. For any questions or ambiguity, you are requested to contact me via email for clarification.