hugo: hugo new theme does not create a baseof.html

As Block-Templates are the new default I think that the directory layout of a theme created by hugo new should reflect this and create a baseof.html in _default.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 20 (17 by maintainers)

Commits related to this issue

Most upvoted comments

And we crossed streams. Oops.

This would be a good start:

<html>
    {{- partial "head.html" . -}}
    <body>
        {{- partial "header.html" . -}}
        <div id="content">
        {{- block "main" . }}{{- end }}
        </div>
        {{- partial "footer.html" . -}}
    </body>
</html>

The partial pattern is still useful and should still be part of the scheleton, as long as the templates are well formed:

<html>
    {{- partial "header.html" . -}}
    <body>
        <div id="content">
        {{- block "main" . }}{{- end }}
        </div>
        {{- partial "footer.html" . -}}
    </body>
</html>

Or variants of the above. In the above, all templates are well formed (base + footer + partial).

The general tenor of the comments seems to supports this proposal. I would to extend this thought by linking the files together as follows:

Hugo generates header.html and footer.html by default. So the baseof.html would look like this:

{{- partial "header.html" . -}}

{{- block "main" . }}{{- end }}

{{- partial "footer.html" . -}}

404.html, list.html, single.html and index.html would consist of

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