-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error instead of quiet logging when no layout can be found #1313
Comments
(I eventually happened on --log and dug into the log file, but I could see how folks wouldn't get that far.) |
We could have something like this: // in hugolib/site.go :
func (s *Site) renderForLayouts(name string, d interface{}, w io.Writer, layouts ...string) error {
layout, found := s.findFirstLayout(layouts...)
// user have to define a layout, unless params.AllowEmptyLayout is set to true.
if found == false && viper.GetBool("AllowEmptyLayout") == false {
jww.ERROR.Printf("Unable to locate layout for %s: %s. Please set a layout or AllowEmptyLayout to true in your config file if you really want this.\n", name, layouts)
return nil
}
if err := s.renderThing(d, layout, w); err != nil {
[…] |
So any fix to this must have some sense of what templates are vital to render a site:
|
Thank you for your explanation. But maybe that WARN message is acceptable? |
👍 I have -v and --log enabled and I get no error or warning for blank pages that are rendered. It would be really helpful to see a list what Hugo is trying to resolve to in order to grok Hugo a bit better. |
We have to figure out another way. There are perfectly valid reasons not having a layout for a page (I have have some broken sites as result of this). See gohugoio#1313 This reverts commit b159340.
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Was porting my site from jekyll to hugo, and hadn't written a layout for my posts section yet when I copied over my articles. Hugo silently elides pages without a layout instead of erroring vocally or exiting early. My site "worked" but had no pages in it.
It would be nice for it to error out and make a lot of noise (or, at least, make a lot of noise) when it can't find a layout.
Relevant code is in hugolib/site.go.
The text was updated successfully, but these errors were encountered: