I need the child items from folder1 and folder2 to be accessible via url, but I want to get rid of the auto-generated section pages folder1 and folder2. In my case, I want the links to /folder1/ and /folder2/ to return a 404.html page with an appropriate status code.
In the docs, I found that the “disableKinds” attribute disables the generation of the list pages. Everything works well, except that the links to /folder1/ and /folder2/ still return a 200 status code and an empty HTML document. How do I force those list pages to show my styled 404.html page and return a 404 status code?
create 2 files
folder1/_index.md and forlder2/_index.md
Design it like 404 pages …
standard template should be a list.html
with custom templates - create layouts/folder1/list.html and layouts/folder2.html as template,
can be a complete 404 design without using the markdown files
With disableKinds = ['section'] in your site configuration, section pages are not generated when you run hugo. Look at the contents of the public/ directory.