Disable warnings during build

I get a long list of multiple of these warnings during build. How do I disable them?

WARN 2021/11/30 19:48:50 found no layout file for "HTML" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

WARN 2021/11/30 19:48:50 found no layout file for "HTML" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

Fix the underlying problem.

2 Likes

I have defined my layouts based on folder directory in content. Is that an issue?

Hugo is trying to prevent a self-inflicted wound, both now and in the future. If you don’t want to see warnings, create templates to satisfy the requirements.

Alright. let me check how to.

I figured out two of them, but now one is remaining. I have an index.son file in the root of the layout folder for site search. Which kind of a file should I create for it? I have tried list.json in layouts/_default but it is not working. Here is the warning.
found no layout file for "JSON" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

What does the [outputs] section of your site configuration look like?

Like this (I am using a dedicated page for search at /search/)

[outputs]
	home = ["HTML","RSS","JSON"]
	page = ["HTML","JSON"]

Edit: Thanks for the hint. I thought this page = ["HTML","JSON"] was required for the search results to show. Seems not based on localhost test. Solved.

Is there a reason to generate JSON for a page, or only for home?

No reason, it seems. See my previous comment.

The error disappeared on the local build but shows up on Cloudflare pages build.

Then the two environments are different.

I see. I heard Cloudflare might be using an old instance of Hugo.

The error is also appearing on Netlify. But on local, both hugo and hugo serve don’t show any errors. found no layout file for "JSON" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination. I have an index.json file in the layouts folder that builds a list of posts for my search page. Which file do I need to create to override this warning? Both list.json.json and index.json.json in layout_default didn’t work.

Found the problem. Ignore.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.