Empty side when using {{ define "main" }} in home.html

I don’t even know anymore.
I try creating a theme, so the layout directory is under themes/ and the theme is configured in config.toml.
With the following files and commands, I always get only an empty page:

I tested:

  • In content/ a home. md and/or index. md with and without Front Matter
  • hugo server with -DEF, --diableFastRender --disableFastRender --ignoreCache --noHTTPCache
  • Multiple browsers and clearing the browser cache.

My files/directories

The layouts/ directory

├── _defaults/
│   ├── baseof.html
│   ├── list.html
│   └── single.html
├── 404.html
└── home.html

The _defaults/baseof.html file

<!DOCTYPE html>
	{{ block "main" . }}{{ end }}

The layouts/home.html file

{{ define "main" }}
{{ end }}

The rendered website when inspected in the browser


404.html, list.html and single.html are empty.

Hugo Version: Hugo Static Site Generator v0.74.3/extended linux/amd64

When I remove {{ define "main" }} and leave only home.html the content is displayed, but of course the content of baseof is not.
The only solution I found is to create a second baseof.html file in layouts. But with only a baseof.html in the _defaults directory the problem occurs, although both are present in the lookup order.

Am I misunderstanding the lookup order and use of block/define or is this a bug?

The directory name should be _default not _defaults.


Oh, my goodness. I literally facepalmed.
I didn’t notice this the whole time and I tried to make the possibilities for mistakes smaller and smaller, by removing unnecessary files…
Thank you so much. That was a really dumb mistake…

Edit: I think deleting this topic would be appropriate, since the solution to a spelling mistake will probably help nobody.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.