Iterating through all folders in a subdirectory to list RegularPages and access Params

In my /content/ folder, I previously had pages set up like so:

/content/posts
/content/posts/_index.html
/content/posts/mypost.html
/content/posts/mysecondpost.html

And was displaying them through the following range:

{{ range where (where .Site.RegularPages "Type" "posts") "File.Dir" "posts/" }}{{ end }}

This allowed me to list out all of the posts that were in that directory through their .Params.

The issue with that previous organization is that the posts were not able to appropriately have the layout applied. So the directory now resembles the following:

/content/posts
/content/posts/_index.html
/content/posts/mypost/_index.html
/content/posts/mysecondpost/_index.html

If I leave it at just (where .Site.RegularPages "Type" "posts") it displays nothing, so it must not recursively go through sub-directories. I could define "File.Dir" "posts/mypost/" etc, but that would require specifically naming each folder which is inefficient and difficult to maintain.

How do I recursively list out all posts in subdirectories through a .Range in order to access their .Params for each?

try

where .Section “posts”

first sample in

This is a support ticket that is a continuation of this topic:

I am afraid that things do not work in this forum as you wish.
You need to keep everything in one topic.
Not mark the original ticket as solved and then post another topic with the new problems that emerged after the supposed solution.

You really need to share a repo of your project.
If you cannot share it then create a repo with dummy content, that reproduces the original problem.

I am closing this topic as the original issue in the other topic is not really solved.

Turning content meant as single pages to sections will not be practical for your project in the long run.