-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
I'm not sure if this is a bug or an expected/acceptable incompatibility when migrating from v0.145.0 to v0.146.0.
Given this directory structure:
layouts/
├── _default/
│ ├── baseof.html
│ ├── home.html
│ ├── list.html
│ └── single.html
└── partials/
└── foo.html
This works in v0.145.0:
{{ template "partials/foo.html" . }}
The above does not work in v0.146.0:
Error: error building site: html/template:home.html:20:14: no such template "partials/foo.html"
To make it work like before I can either:
1) Keep the directory structure the same and call:
{{ template "_partials/foo.html" . }}
Or
2) Rename layouts/partials to layouts/_partials and call:
{{ template "_partials/foo.html" . }}
There's a similar scenario when the template path starts with _default.
Related: https://discourse.gohugo.io/t/hugo-0-146-3-preview-of-docsy-userguide-fails/54315/6
With v0.145.0 and earlier, with exception of embedded templates (e.g., _internal/pagination.html), I'm not sure why site/theme authors would call the template function instead of partial or partialCached. And with v0.146.0 and later the _internal namespace is deprecated (will be removed in the future), so I can't really think of a good reason to use the template function other than recursion (e.g., using template with define to walk something). And even in that use case, the only benefit of using template instead of an inline partial is that it is locally scoped.