Best approach to content tree modeling (Region, Country, States & Cities)

I’m looking for the most practical approach to content tree modeling in Contentful. The content tree I’m envisioning is this:

  • Region
    • Country
      • States
        • Cities

I want to structure this in a way that:

  • I can send a GET request to find out which Region/Country/States/Cities have the most blog posts
  • I can list all articles under a specific Region/Country/State/City with the least amount of API calls
  • I can list all states in a region, or all countries in a region, etc.

I’ve currently set up content types for each of them with a reference field. Each city (Berlin, San Francisco, etc) would have a reference field that links to a country (California, Germany, etc). This pattern continues up the chain. Each of these taxonomy terms have additional fields, such as Name & entry_count.

When I create a new entry under a taxonomy term, I simply add to the entry_count field for each of them respectively. When an entry is removed, I subtract.

It works, but there are margins for error since I have to programmatically adjust each taxonomy term every time a new entry is added. It also feels very messy and feels more like a hack.

Is there a better approach than this?

Hi @matiasbryan, as stated by my colleague in another thread:

It mostly depends from your use case. My suggestion is to follow the links he suggested and come back to this thread if you have any further question :slight_smile: