Site structure / template

Hello,
I got a structure like this one in /content :

.
├── _index.md
├── about
│   └── _index.md
├── contact
│   └── _index.md
├── industries
│   └── _index.md
├── insights
│   ├── _index.md
│   ├── guides
│   │   ├── _index.md
│   │   ├── guide1.md
│   │   ├── guide2.md
│   │   └── guide3.md
│   └── posts
│       ├── _index.md
│       ├── article1
│       │   └── _index.md
│       ├── article2
│       │   └── _index.md
│       ├── article3
│       │   └── _index.md
│       ├── article4
│       │   └── _index.md
│       └── article5
│           └── _index.md
├── privacy-policy
│   └── _index.md
├── services
│   └── _index.md
└── terms
    └── _index.md

I guess it’s simple (but tried everything I found here and there but does not work) but how I can apply a specific template to :

* /content/insights/_index.md (it's a section page where will be listed pages from sub folders : /blog and /guides
* /content/insights/guides/_index.md (it's a sub section page that will list the pages from /content/insights/guides)
* /content/insights/guides/guide1md (will be a specific template for guide pages)
*/content/insights/guides/blog/_index.md (it's a sub section page that will list the pages from /content/insights/guides)
*/content/insights/guides/blog/article1/article1.md (will be a specific template for blog article)

Now I tried various options (replicate the “tree” in layouts) > works but not for sub folders. Tried with type in frontmatter : does not work and few other things but nothing works. Could you please help me with the structure.
Thanks a lot

Use a layout parameter and then place that particular template under layouts/_default/.

Again there are plenty of examples in the forum.

For example layout = "guide" will use /layouts/_default/guide.html

Also see: Hugo's Lookup Order | Hugo

so the solution for sub sub folder content if we want to template is to use “layout” in front mater and get a template in _default with a layout named the same?

That is part of the solution. One can also specify templates for single.html and list.html under layouts/guide/ if needed.

I like the front matter solution more and it works. Was not working because I had _index.html for articles and now with index.html it works.

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