[Solved] Type in frontmatter seems to be ignored

Hi,

this is my theme layouts/ structure:

├── 404.html
├── article
│   └── single.html
├── _default
│   ├── latest.html
│   ├── li.html
│   ├── list.html
│   ├── micro_latest.html
│   ├── micro_li.html
│   ├── single.html
│   └── taxonomy.html
├── index.html
├── micro
│   └── single.html
├── page
│   └── single.html
├── partials
 ( ... )
├── post
│   └── single.html
├── robots.txt
└── section
    └── micro.html

This is the sites contentent/ structure:

.
├── about
│   └── index.md
├── article
│   ├── example
│   │   └── index.md
│   ├── example2
│   │   └── index.md
│   ├── example-article-long.md
│   ├── example-long-image
│   │   ├── examplebanner.png
│   │   ├── exampleogimage.png
│   │   └── index.md
│   └── README.md
├── main-testpage
│   └── index.md
├── micro
│   ├── 1610121634.md
│   ├── 1610121637.md
│   ├── 1610121643.md
│   ├── 1610122008.md
│   ├── test2.md
│   └── test.md
├── post
│   ├── examplepost
│   │   ├── examplebanner.png
│   │   └── index.md
│   ├── good-to-great.md
│   └── test.md
└── testpage
    └── index.md

This is the content of about/index.md

+++
date = "2016-09-17T18:22:06+02:00"
title = "about"
type = "page"

[menu.footer]
    Name = "About"
+++

## The About Page
Blabla... 

Why is page/single.html not used to render /about/index.md?

Because you need to move that template under /layouts/page/single.html

It is /layouts/page/single.html.

At the root of your Hugo project under /layouts/. Not under/themes/theme-name/layouts/

To make it plain.

A theme is a theme. To define a content type or override parts of a theme you do so under/hugo-project-root/layouts/

It is a part of the theme I have created.

If someone might have a look, this is the none working state : https://github.com/innerand/mara/tree/develop.
I am coming from hugo 0.17 and trying to go to 0.31.1 (don’t ask).

See Content Types

As far as I know you define a Content Type through Archetypes and the template goes at the directory that I mentioned above.

Not sure if you can define a Content Type from a theme.

I don’t have time right now, but I wanted to propose adding a different post with that type, elsewhere. Put it somewhere like, about/test.md, so it would render at example.com/about/test/, and see which template it is picking up.

I like to test other pages before index pages, in case they are treated differently. Considering your jump in versions, index pages are handled differently, as well (I think it was around 18 or 19 where it changed). :slight_smile:

Also, @alexandros may be on to something, according to the content types lookup order, it only lists templates from inside the site, not the theme (the other lookup orders are exhaustive).

We can update the docs to explain this, so in the meantime you might move over the template and see if it works as expected.

Sorry for the multiple posting, I just had this train of thought regarding this: aside from how content types work, I am not sure the single.html template is for that index page. Isn’t that a section?

I don’t use index pages in this way, so I only know from reading other accounts, but I think that is a section (and hence follows the section template lookup order), and content types work on content pages (which makes sense, since types overrides the default assumption of “section”).

I’d move about/index.md to about.md and see if it picks up the correct template.

Thank you for your support maiki and onedrawingperday,

content/about.md or content/about/test.md is rendered with the selected layout. So you were right and the problem is with index.md but it only happens if the type is set at the frontmatter. Other pages, e.g. article\example\index.md are rendered as expected.
As I started with the theme there was something like about/index.md described in the documentation to have the content in a folder but still the url example.com/about. I guess this was changed to about/single.md (and _index.md was added with other functionality).

tl;dr
renaming index.md to single.md solves the problem.

Thanks again.