Can't make baseof + blocks templates work


I have _default/baseof.html defined with

{{ block "main" . }}

{{ end }}

inside of it.
As soon as I modify a template, say home.html, from {{ .Content }} to

{{ define "main" }}
  {{ .Content }}
{{ end }}

the template is not working any more, I’ve got a function "page" not defined error, any idea why?


Some of the pages using your block main may mot have e.Content available.
It’s hard to help without the repo though.


The page using baseof.html + home.html is content/ and contains only “home”. I am initiating Hugo so I have dummy files to test it.
Here is the repo but I don’t think you need it as my question is about very basic behavior and not bound to my content since I don’t have content (I just put “home” to test)…


I assume you have errors in your log?

The very first template code looks wrong. Scrolling down I see more errors. Go template code are not very forgiving; you have to type exactly the right commands and function names etc.


Oh yes, it’s because I copied the code from Jekyll without adapting to Hugo, just to test the layouts system. I thought at least it would output something weird, but Hugo doesn’t output anything… When removing Jekyll snippets it outputs something. Unforgiving as you say ^^ Thank you.