Are complex URL hierarchy possible?

Hi, i want to create a product review site and I’m wondering if complex URL hierarchy is possible.

I’m aware of the Ideas Nested/hierarchical tags, subtags, but my understanding is that this nested/hierarchical tags subtags don’t apply to URL. Am I wrong?

Because the same products are not available in North America and Europe and also people can speak more than one language in one specific country, I want to be able to adapt to the market with this kind of hierarchy.

I want to achieve a structure who would look like this:

Generic structure

https://www.mydomain.com/countrycode/langage/reviews/category1/best-product1.html

https://www.mydomain.com/countrycode/langage/reviews/category2/best-product1.html

https://www.mydomain.com/countrycode/langage/deals/productsdeals.html

https://www.mydomain.com/countrycode/langage/blog/blog.html

Canada English

https://www.mydomain.com/ca/en/reviews/category1/best-product1.html

https://www.mydomain.com/ca/en/reviews/category1/best-product2.html

https://www.mydomain.com/ca/en/deals/canada-deals.html

Canada French

https://www.mydomain.com/ca/fr/reviews/category1/best-product1.html

https://www.mydomain.com/ca/fr/reviews/category1/best-product2.html

https://www.mydomain.com/ca/fr/deals/canada-deals.html

France

https://www.mydomain.com/fr/fr/reviews/category1/best-product1.html

https://www.mydomain.com/fr/fr/reviews/category1/best-product2.html

https://www.mydomain.com/fr/fr/deals/france-deals.html

Is that possible or will it be possible one day?

You can achieve this using are dynamic routing feature - you can check out the docs here:Ghost Themes - Dynamic URLs & Routing

There is also this document which is more specific to your use-case which you may find useful Tutorials

Hope this helps!

1 Like

Thank you so much, I’m really happy with what I see from Ghost so far! :slight_smile:

1 Like

In order to do the URL structure mentioned in the first post, I have created the following tags:

Internal country tags

  • #country-ca
  • #country-fr

Internal language tags

  • #language-en
  • #language-fr

Internal content category / sub-category

  • #electronics-computers
  • #electronics-audio

Content type tag

  • Reviews

Here is my route.yaml file content:

routes:
  /:
    controller: channel
    template: index
  /ca/fr/evaluations/electronique/ordinateurs/:
    controller: channel
    filter: tag:review+tag:electronics-computers+tag:#country-ca+tag:#language-fr
    template: index
  /ca/en/reviews/electronics/computers/:
    controller: channel
    filter: tag:review+tag:electronics-computers+tag:#country-ca+tag:#language-en
    template: index
  /fr/fr/evaluations/electronique/ordinateurs/:
    controller: channel
    filter: tag:review+tag:electronics-computers+tag:#country-fr+tag:#language-fr
    template: index
  /ca/fr/evaluations/electronique/audio/:
    controller: channel
    filter: tag:review+tag:electronics-audio+tag:#country-ca+tag:#language-fr
    template: index
  /ca/en/reviews/electronics/audio/:
    controller: channel
    filter: tag:review+tag:electronics-audio+tag:#country-ca+tag:#language-en
    template: index
  /fr/fr/evaluations/electronique/audio/:
    controller: channel
    filter: tag:review+tag:electronics-audio+tag:#country-fr+tag:#language-fr
    template: index

collections:
  /ca/fr/evaluations/:
    permalink: /ca/fr/evaluations/{slug}/
    filter: tag:review+tag:#country-ca+tag:#language-fr
  /ca/en/reviews/:
    permalink: /ca/en/reviews/{slug}/
    filter: tag:review+tag:#country-ca+tag:#language-en
  /fr/fr/evaluations/:
    permalink: /fr/fr/evaluations/{slug}/
    filter: tag:review+tag:#country-fr+tag:#language-fr
  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

I have created 6 posts with the following tags.

Post 1

  • Title: Meilleur clavier ergonomique ca-fr
  • Tags: review + #country-ca + #language-fr + #electronics-computer

Post 2

  • Title: The Best Ergonomic Keyboard ca-en
  • Tags: review + #country-ca + #language-en + #electronics-computer

Post 3

  • Title: Meilleur clavier ergonomique fr-fr
  • Tags: review + #country-fr + #language-fr + #electronics-computer

Post 4

  • Title: La meilleure barre de son ca-fr
  • Tags: review + #country-ca + #language-fr + #electronics-audio

Post 5

  • Title: The Best Soundbar ca-en
  • Tags: review + #country-ca + #language-en + #electronics-audio

Post 6

  • Title: La meilleure barre de son fr-fr
  • Tags: review + #country-fr + #language-fr + #electronics-audio

Unfortunately, every channel URL i try show nothing. For example :

Same goes for collections url. The only URL who show something is the homepage (/).

Question 1 : Why my channels url don’t work?

Question 2 : Do you have any idea how to create a navigation based per country/language? (see apple.com - Apple (Canada) - etc.)

I just begin with Ghost and I’m not sure where i missed something.

I removed the / collection as I read that a post can only be in one collection.

The channel URL dont show any post but they seem to “work” because they don’t give me a 404 error.

I wonder why no post show at theses URLs. Is there a limit on the number of allowed tags in the filter?

route.yaml updated

routes:
  /:
    controller: channel
    template: index
  /ca/fr/evaluations/electronique/ordinateurs/:
    controller: channel
    filter: tag:review+tag:electronics-computers+tag:#country-ca+tag:#language-fr
    template: index
  /ca/en/reviews/electronics/computers/:
    controller: channel
    filter: tag:review+tag:electronics-computers+tag:#country-ca+tag:#language-en
    template: index
  /fr/fr/evaluations/electronique/ordinateurs/:
    controller: channel
    filter: tag:review+tag:electronics-computers+tag:#country-fr+tag:#language-fr
    template: index
  /ca/fr/evaluations/electronique/audio/:
    controller: channel
    filter: tag:review+tag:electronics-audio+tag:#country-ca+tag:#language-fr
    template: index
  /ca/en/reviews/electronics/audio/:
    controller: channel
    filter: tag:review+tag:electronics-audio+tag:#country-ca+tag:#language-en
    template: index
  /fr/fr/evaluations/electronique/audio/:
    controller: channel
    filter: tag:review+tag:electronics-audio+tag:#country-fr+tag:#language-fr
    template: index

collections:
  /ca/fr/evaluations/:
    permalink: /ca/fr/evaluations/{slug}/
    filter: tag:review+tag:#country-ca+tag:#language-fr
  /ca/en/reviews/:
    permalink: /ca/en/reviews/{slug}/
    filter: tag:review+tag:#country-ca+tag:#language-en
  /fr/fr/evaluations/:
    permalink: /fr/fr/evaluations/{slug}/
    filter: tag:review+tag:#country-fr+tag:#language-fr

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

I replaced all my internal tag with Primary tag + Regular Tag and now it works.

Can someone explain to me the limitation of using Internal tag?

If you’re using internal tags you need to make sure you’re using the right slugs, internal tag slugs typically start with hash- so you’d have slugs like hash-country-ca rather than #country-ca which is not a valid slug name.

Thank you for your answer, I will try it soon.

It work like a charm!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.