Is it possible to create two levels deep URL structure in Ghost?

Here’s what I’m trying to achieve:

I was wondering if it’s possible to have a url structure that’s two sub-folders deep? Example: domain.com/topic/subtopic/{slug-for-article1}

In the above URL structure, I would like to keep my /topic/ constant, /subtopic/ vary based on the tag, and then have the slug for the respective article.

I know it’s possible to customize what the URL is supposed to be for a single sub-folder level URL. Just not sure if two sub-folder URL is possible.

Would really appreciate it if you could point me in the right direction. :slight_smile:

Yup, you’d set up some collections via routing:

Here’s a portion of a routes.yaml file of mine to show how I did it:

collections:
  /:
    permalink: /{slug}/
    template: index
  /crisis/climate-catastrophe/:
    permalink: /crisis/climate-catastrophe/{slug}/
    template: crisis-solutions-research/crisis-climate-catastrophe
    filter: tag:climate-catastrophe
  /crisis/energy-depletion/:
    permalink: /crisis/energy-depletion/{slug}/
    template: crisis-solutions-research/crisis-energy-depletion
    filter: tag:energy-depletion
  /crisis/food-crisis/:
    permalink: /crisis/food-crisis/{slug}/
    template: crisis-solutions-research/crisis-food-crisis
    filter: tag:food-crisis

I then created custom templates for each subsection (so I could give the page for each subsection its own title, etc.) and dropped those into a common directory. For example, I have a crisis-energy-depletion.hbs file in the /crisis-solutions-research directory, and so forth.

Hope that helps.

3 Likes

This is helpful @Stromfeldt. If you don’t mind, could you also share with me the URL to your site? Would love to play around and get a better understanding of the interaction as well.

Sorry, that site, for a colleague of mine, is still in development and so is behind a password. Perhaps it’ll be launched later this month is the best I can say.

Cheers. No worries. Your response by itself was helpful. So, thank you! :slight_smile: