I am new to Hugo and static sites and encountered a couple of problems usually due to misunderstandings and after some research I could fix it myself. However I am struggling with an issue seemingly related to this.
I want to customize a specific taxonomy terms page with layouts/taxonomy/country.terms.html
. I also have a general layouts/_default/terms.html
.
/countries/
renders the general terms.html
based site fine, if I temporarily change the filename of country.terms.html
to e.g. test.terms.html
. However as long as I have country.terms.html
I just get an empty page.
And it’s related to this code:
{{ define "title"}} {{ .Title}} {{end}}
{{ define "header"}}
{{ partial "header" . }}
{{end}}
{{ define "main" }}
custom-html-content-here
{{ end }}
{{ define "footer"}}
{{ partial "footer" . }}
{{end}}
This code works everywhere else including terms.html
. I also don’t get an empty page, if I change country.terms.html
to e.g.
{{ define "title"}} {{ .Title}} {{end}}
{{ define "header"}}
{{ partial "header" . }}
{{end}}
{{ define "main" }}
custom-html-content-here
{{ end }}
<div>Test 123</div>
{{ define "footer"}}
{{ partial "footer" . }}
{{end}}
I will see the Test 123. Rendering partials also works, when outside the {{ define }}
context. So I can create a barebone custom country terms html with the partials without defines, but then the baseof.html
from the theme is missing.
I read in the documentation about templates, partials, block, themes and so on, but I could not find a solution so far. Any ideas what I do wrong?
Thank you.