I have this structure:
and I set permalinks in config:
menu = "/:filename"
What is the best way to set
/menu list as not existing (404) but
I know I can put
page2.md in the root of
content/ folder, but is a way how can I do the same if pages are in
If I create empty file
/layout/menu/list.html it shows nothing for
/menu/ but ideally I would like to get 404 error.
Thanks for links, I already read this pages, but I am still confused how to achieve this. I tried to add
_index.md with headless=true or without. I still get list of pages for url
- rename menu/list.html template to empty.html
- put anything in the content to check the right template is used
- set layout=“empty”
- set headless=true in frontmatter
use hugo --debug to get more information
if I set headless then all children are 404 not found…
@Marek_Lichtner You could redirect the user to your 404 page. So in your
layout/menu/list.html have something like this
<meta http-equiv="refresh" content="0; url=/404/" />
I’ve just found a solution that works for me. This is the content of
url = "/"
The advantage is that the url to this branch is not displayed in sitemap.xml(!).
However, I don’t know if this solution will work permanently because the same URL is used for multiple pages. A
headless option for branches (_index.md) would be safer.
This question is related.