Unify the section template lookup order, please comment

There are quite a few issues/discussion around about the slightly confusing template lookup order, esp. for the section lists.

I will try to fix this. There is also an open issue about the base template selection, but I will take that later.

I will try to summarize. Below are the current truth:

Single

/layouts/TYPE/LAYOUT.html
/layouts/SECTION/LAYOUT.html
/layouts/TYPE/single.html
/layouts/SECTION/single.html
/layouts/_default/single.html
/themes/THEME/layouts/TYPE/LAYOUT.html
/themes/THEME/layouts/SECTION/LAYOUT.html
/themes/THEME/layouts/TYPE/single.html
/themes/THEME/layouts/SECTION/single.html
/themes/THEME/layouts/_default/single.html

List

/layouts/section/SECTION.html
/layouts/_default/section.html
/layouts/_default/list.html
/themes/THEME/layouts/section/SECTION.html
/themes/THEME/layouts/_default/section.html
/themes/THEME/layouts/_default/list.html

Proposed change

The main pain point in the above, is the way, say for the section “blog”:

  • Single template => /layouts/blog/single.html
  • List template => /layouts/section/blog.html

I propose we add, using the example, /layouts/blog/list.html to the section list lookup path (as #2 in the list above):

/layouts/section/SECTION.html
/layouts/SECTION/list.html <=== NEW
/layouts/_default/section.html
/layouts/_default/list.html
/themes/THEME/layouts/section/SECTION.html
/themes/THEME/layouts/_default/section.html
/themes/THEME/layouts/_default/list.html

Makes sense?

1 Like

Makes sense. I like it.

Also remember to add it to the themes path lookups, too.

1 Like

AWESOME! :thumbsup: :thumbsup: :thumbsup:

makes sense, that was a painful thing for me to figure out, :slightly_smiling:

Would that mean you add
/themes/THEME/layouts/SECTION/list.html
also?

Yes, see

great - and also great idea, because it took me some time to figure out where to place my special list file for the blog section - and it’s more easy to find single.html for a section and list.html in the same section folder.:+1: