Creating tabbed sections on a list page using leaf bundles

Hi there, I’m having trouble filtering and rendering the correct content pages on my list page. Here is my directory structure:

content
     |
     |----- services
                  |
                  |----- service-1
                  |            |
                  |            |----- content-1.md
                  |            |----- content-2.md
                  |            |----- index.md
                  |            
                  |----- service-2
                  |            |
                  |            |----- content-1.md
                  |            |----- content-2.md
                  |            |----- index.md
                  |            
                  |----- service-3...

On the services list page, I’m trying to create tabs which display only one of the three services at a time (each service is a tab). At the top of the pages, I’d like to render just the index.md of a service and at the bottom of the page, I’d like to loop through and render the remaining markdown files (content-1.md and content-2.md), but I’m not sure how to do it. My first loop currently renders all markdown files, the second loop renders all resource pages.

{{ with .Pages }}
  {{ range . }}
    {{ .Content }} // here I want to render just each service-*/index.md 
  {{ end }}
{{ end }}

{{ range .Pages }}
  {{ range .Resources.ByType "page" }}
    {{ .Content }} // here I want to render just each service-*/content-*.md
  {{ end }}
{{ end }}

Eventually if I can get the right markdown files to render and each service grouped together, I’ll have tabs that display only one service at a time on the services list page.

I’m not totally sure what the problem is, but I suspect it is the initial page selection.

Try:

{{ with .RegularPages }}

Also see where if you want to filter.