How to group posts dynamically

Hi,
I would like to create a travel blog, and I’d like to have the images of the continents on the home page, when you click on one of them a page will open containing only the states belonging to that continent, in turn when you click on a state you will see the cities connected to the state and last when click on a city I would like to see the articles / posts related to that city.
I don’t know how to handle all these subdivisions (continen->states->city->articles/posts).

-In you opinion, which is the best way to obtain this result?

-Do I have to create a customized HBS file for each continent, state and city?
I think it can be very expensive to do. I should really create many pages.

-Is there any way to create only one template for continent, state and city that fits the click request?
I’m making several attempts, but I can’t pass parameters via the URL, so I think anything dynamic can be created.

Please, any advice is welcome.

Kind regards,
Amedeo

Hey @Amedeo_Lomonte,

I think you might benefit from checking out our theme docs where we’ve provided detailed information how how template work in Ghost and how you can create custom templates for specific routes or pages:

Hi David,
I already read your documentation, I just want someone to tell me what would be the most optimized method for what I want to do.

Please, can you answer my question?

Your grouping convention is somewhat complex, I’m wondering if it needs to be for the task at hand. Also you’re using continents and states to group locations, but not countries? This will be an issue as not all continents / countries are using states to divide areas.

Maybe you should check out tags and primary tags, this might be a good starting point for structuring your content into groups:

Thank you.

1 Like