Skip to content
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

hugolib/site_render.go: Warn when missing layout files for content pages #3594

Closed
wants to merge 2 commits into from
Closed

hugolib/site_render.go: Warn when missing layout files for content pages #3594

wants to merge 2 commits into from

Conversation

adiabatic
Copy link
Contributor

This is very much a work-in-progress, debugging printfs and all. I thought discussing code would be easier done here than on the Discourse instance. That said…

One of the things I've noticed is that I'll screw something up and not be able to figure out what I did wrong. I'd like this patch to tell the user, in the output of hugo serve -w, that content exists for which there is no layout.

Since the docs say /tags/ and /categories/ aren't built by default anymore, I removed the line that adds them to the list of default taxonomies. That seems like the proper way.

With the current debugging printfs enabled, I get reasonable warning messages like the following:

Started building sites ...
No layout for "/about/" found in the usual places.
Found a layout for "/"
Found a layout for "/"
Built site for language en:
0 draft content
0 future content
0 expired content
1 regular pages created
2 other pages created
0 non-page files copied
0 paginator pages created
total in 1 ms

The "Found a layout for…" messages aren't useful except for me debugging this patch, but what do you think of the changes I've made to get the "No layout for…" messages in the user-visible output?

@bep bep added the InProgress label Jun 15, 2017
@@ -101,7 +101,6 @@ func loadDefaultSettingsFor(v *viper.Viper) {
v.SetDefault("canonifyURLs", false)
v.SetDefault("relativeURLs", false)
v.SetDefault("removePathAccents", false)
v.SetDefault("taxonomies", map[string]string{"tag": "tags", "category": "categories"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like a good idea.

@bep
Copy link
Member

bep commented Jun 15, 2017

I'm pretty sure we log this as warnings today:

https://github.com/gohugoio/hugo/blob/master/hugolib/site.go#L1911

Try hugo -v.

If not, we should fix that and not add more code that try to do the same.

@bep
Copy link
Member

bep commented Jun 15, 2017

I get mails about build failures etc. from this PR, so I will close it now. If you still think there is an issue here, please discuss it on the forum.

@bep bep closed this Jun 15, 2017
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants