How to list /content/section/subsection1, subsection2, etc

Hello. On my site, https://www.psychedelicsdaily.com you see towards the bottom, “Find The Others” section which comes from /content/community. https://gitlab.com/hashborgir/psychedelicsdaily.com-hugo/-/blob/master/themes/hugo-universal-theme/layouts/partials/recent_community.html

It lists all the pages as in https://gitlab.com/hashborgir/psychedelicsdaily.com-hugo/-/blob/master/themes/hugo-universal-theme/layouts/partials/recent_community.html I am doing

{{ range first 15 (where .Site.Pages "Type" "community") | shuffle}}
{{ range first 15 (where .Site.RegularPages "Section" "community") | shuffle}}

And I’ve tried many other variations of this as well, but I can’t get it to list only the countries underneath.

In the https://gitlab.com/hashborgir/psychedelicsdaily.com-hugo/-/tree/master/content/community section I have

/content/community/australia/_index.md
/content/community/austia/_index.md
/content/community/belgium/_index.md
/content/community/canada/_index.md

Etc. So I’ve got the directory structure correct, which shows up fine when you go to the individual sections. However, in the main page, the https://gitlab.com/hashborgir/psychedelicsdaily.com-hugo/-/blob/master/themes/hugo-universal-theme/layouts/partials/recent_community.html renders pages, instead of the countries only.

I would like to list only the countries and no other pages in https://gitlab.com/hashborgir/psychedelicsdaily.com-hugo/-/blob/master/themes/hugo-universal-theme/layouts/partials/recent_community.html. I can’t seem to figure out this thing.

Say for example you go to https://www.psychedelicsdaily.com/community/ you see only the countries listed here.

I want the same exact thing on but I can only ever get ALL the pages in Communities.

I’m not sure how to grab a list of these subsections only. If you look in the repository, every country has it’s own _index.md file.

Here is the link to the repository:

After many hours of searching the forums, I found this: Listing nested directories

Then I did what @budparr suggested:

{{ $sections := (.Site.GetPage "section" "community").Sections }}

{{ range first 15 $sections | shuffle}}

And that shows the countries only now. I never heard of the .GetPage function. I do not see this mentioned on https://gohugo.io/variables/site/ unless I missed something.

What does this function really do? .GetPage from section called community and then get .Sections from that? I didn’t even know you could do that. Cool.

I found the function here instead. I didn’t realize one could call functions on .Site.