How to range pages from folder by Parameter?

Hi. I have this structure of my site:

– main_category:
---- _index.md
---- category 1
------ _index.md
------ article-1-1.md
------ article-1-2.md
------ article-1-3.md
---- category 2
------ _index.md
------ article-2-1.md
------ article-2-2.md
------ article-2-3.md

I need to range article from category 1 to first part of main_category layout, and range article from category 2 to second part of main_category layout. I have parameter for category 1 in _index.md (state = “aviable”), and for category 2 (state = “previous”). How i can take children pages of category 1/2, use parameter for category?

I use this code, but take only category 1/2 pages. Not their children’s pages:

{{ range where .RegularPages "Params.state" "aviable" }}