Get child pages from another parent

I’m wanting to create a site with a structure similar to as shown below, where I have a /geography directory with 3 different sections: countries, region, and cities. Essentially, I want to have all the pages of information grouped under their relevant category, but be able to access the information of child pages under a different parent.

/geography
      /countries (listing)
            /new-zealand (modular)
      /regions (listing)
            /waikato (modular)
            /northland
      /cities (listing)
            /auckland (default)
            /wellington (default)

For example, on the New Zealand country page, I want to create a module which will pull the child pages from /regions, matching any region page that has the header setting (or taxonomy) country: ‘new-zealand’ and then display certain information related to that page.

Similarly, I’d like to create a module for any /regions child page which would list the cities (plus city page summary, other info etc) that are flagged as part of that region. I figure it’ll be the same process for /regions as it would be for a country page…

I’ve had a look through the documentation, but I’ve not found anything that was clear about whether I could do this or not. I’ve experimented with page.find() and page.collection() but haven’t yet had any luck with getting these to work.

Any help regarding this would be greatly appreciated! Thanks!

Gah, knew I posted too early. Figured out something close enough to what I’m trying to do to probably have answered myself.

In my /country/new-zealand/_region module template I have:

{% for region in page.find('/geography/regions').children %}
    {% if region.header.country|lower == page.parent.title|lower %}
    	{{ region.content }}
    {% endif %}
{% endfor %}

Which finds all the child pages of /regions and compares the country field in the header of that region to the name of the country page, if they match, output the content… ended up being simpler than I thought!

Yup, that’s exactly how I would of done it :slight_smile: