Search code examples
wordpressgithubexportcustom-wordpress-pageshugo

How to fix the error `found no layout file for "HTML" for "page"` in Hugo CMS?


I recently imported content from my WordPress page into Hugo. When I run hugo serve I get following error messages:

WARN 2020/02/17 20:51:06 found no layout file for "HTML" for "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

The page in question starts like this:

---
linktitle: "The Title of the Post"
title: "The Title of the Post"
author: "Franz Drollig"
type: post
date: 2020-01-09T14:41:55+00:00
url: /the-title-of-post/
categories:
  - Uncategorized
weight: 10

---


This is the content of the post. This is the second sentence of the post. 

It is located in mysite/content/posts/YYYY-MM-DD-title.md.

The layouts directory is empty. However, the themes directory contains the book theme. This theme is also configured in the config.toml.

Another post, starting like shown below, is rendered correctly.

---
author: "Michael Henderson"
date: 2014-09-28
linktitle: Creating a New Theme
menu:
  main:
    parent: tutorials
next: /tutorials/github-pages-blog
prev: /tutorials/automated-deployments
title: Creating a New Theme
weight: 10
---


## Introduction

Why is my post not rendered properly? How can I fix it?


Solution

  • I don't have experience with Hugo, but figure I'd comment if it helps to point you in the right direction.

    The front matter seems very different between those two documents. I'm thinking the type: post is probably the culprit.

    What happens if you remove the post front matter altogether?

    These links may also be helfpul:
    Front Matter | Hugo
    Hugo's Lookup Order | Hugo