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/
ahome. md
and/orindex. 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>
<html>
<head>
<title>test</title>
</head>
<body>
{{ block "main" . }}{{ end }}
</body>
</html>
The layouts/home.html
file
{{ define "main" }}
<h1>Home</h1>
{{ end }}
The rendered website when inspected in the browser
<pre>
</pre>
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?