Hugo is not falling back to default listing page

I have the following structure of the content folder:

docs/components/a.html
docs/components/b.html
docs/navigation/a.html

I also have my layouts files:
_default/baseof.html
_default/list.html
_deafult/single.html
/docs/components/list.html

When I try to open localhost:1313/docs/ I would expect hugo to fall back and use _default/list.html but this is not happening. When I go to localhost:1313/docs/components I can see a list of pages since I have layout for it.

Is there any way to make hugo fall back to _default list page in case it doesn’t find specific template? Otherwise I will end up with multiple copies of the same layout for each category.

AFAIK, hugo doesnt support this subsection template structure.

Hugo will treat this /docs/components/list.html same as /docs/list.html


You can try set layout on your frontmatter in content/docs/components/_index.md subsection.

---
layout: components
---

Now you can create this layout structure.

layouts/docs/list.html --> For any list page under "content/docs"
layouts/docs/components.html --> For any page under "content/docs" with `layout: components` set