Which template will render content/news/20/105.md when _index.md exists?

I have content/news/20/_index.md that is rendered by layouts/news/single.html and this is good. I would like to add there 105.md which will be rendered with another template, but with which one?

I also tried to set layout in 105.md Frontmatter, but by some reason layouts/<new_layout>/list.html, layouts/<new_layout>/single.html and even layouts/<new_layout>/<new_layout>.html do not render it

Documentation was not helpful in this.

What is under /news? This could affect how the /news/20 directory is treated.

Also, this sounds like a situation where we really need to see your source repo as per

To explain this, I should go out from news . This should be magazine. So

In the final result, I need to see 3 different pages.

  • /magazine - simple page for all magazines. Some list of all magazines
  • /magazine/20 - a magazine with the number 20.
  • /magazine/20/105 - page for an article with id 105, from magazine 20

My .md:
– content/
**-- magazine/
****|---- index.md ← I expect to build this for /magazine page
****|---- 20/
******|—index.md ← I expect to build this for /magazine/20 page
******|—105.md ← I expect to build this for /magazine/20/105 page

My templates:
– layouts/
**|-- magazine/
****|— list.html ← I expect to build this for /magazine page
****|— single.html ← I expect to build this for /magazine/20 page

And right now I can’t get, where I should locate the template for /magazine/20/105 page

As I suspected, you have made magazine and magazine/20 ‘leaf’ bundles.

You need magazine/index.md and magazine/20/index.md to be _index.md.

For magazine/20/_index.md you will need to either override the layout (or type) or will need to make layouts/magazine/list.html suitable for both magazine and magazine/XX.

Since you don’t have any single pages under magazine itself, the layouts/magazine/single.html ought to work for magazine/XX/XXX.md.

Another option is to not render 105.md directly but to keep magazine/20 as a ‘leaf’ bundle and to use the articles as page resources used by the layout for magazine/20 (which would be the layouts/magazine/single.html layout).

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