Sub-folders for a page?

I’m creating some static Pages for subscribers, that are going to act as Course pages.

The idea is that I curate a bunch of relevant Posts (using /Bookmark cards) on each of these Pages, along with some contextual written content, organise the Posts in a sequence that makes sense for a doing a self-study “course” and might also include some external sources of info, like YouTube clips etc.

I would therefore like to create a sub-folder of my-site/courses/ to host all of these on, e.g.

  • my-site/courses/relationships
  • my-site/courses/stress
  • my-site/courses/anxiety

(Correspondingly, as I build these ‘course’ Pages up over time, it makes sense for me to also have a: my-site/courses/ Page, that has links out to all the other Pages I’m planning on creating, but that’s further down the line for now, and not that important.)

I’ve read through all of the Routing documentation, and a few Forum posts here, and am none the wiser as to how I would actually do this. Is it even possible?

If it’s not possible, which ‘route’, within Ghost’s design language, should I take to achieve a goal like this?

Thanks for the advice

Giles

Those are not subdomains. A subdomain would be like relationships.yiursite.com and stress.yiursite.com.

You should be able to accomplish what you’re describing, but if you’re searching for subdomains, that’s the wrong term :slight_smile:

Sorry, my ignorance. I’ve updated the post with the correct terminology.

Is this a case of editing the routes.yaml file? It doesn’t need to be a different template for the page or anything, I’d just like it to be in a sub-folder/sub-directory.

But how would I then specify that when creating a new page? Whenever I try and put a “/” in a URL, it gets changed to a “-”

(Which in itself makes me think… do I need sub-folders? If I’m in charge of all my URLs, couldn’t I just have my-site/courses-relationships and my-site/courses-anxiety etc … and even my-site/courses as well?)

Is there any practical disadvantage to having it all on the root domain? I just assumed it would be better to keep all the same stuff in a sub-directory cos that’s how I grew up using the internet!

You can individually route posts or pages to an apparent folder structure, but this strikes me as more complex than you might want, since it’s mean edits any time you added a page!

But if you do want your collections of posts to be something like

yoursite.tld/courses/relationships/{slug}, that’s something you can do by setting up a collection for

/courses/relationships/ and setting up a permalink like /courses/relationships/{slug} and a filter like filter: primary_tag:relationships

1 Like

Ahha. I thought I had a post about this somewhere, and I did!

1 Like

Aha, Collections, I’ve seen those mentioned. I’ll look into that more, thanks Cathy.

I read the first blog post you mention here, about tags, thank you!

Questions

  • Does the same routing logic apply to Pages and Posts? (The only thing I’m trying to achieve is a change in URL structure for some Pages)
  • If I were to edit my routes.yaml file to include this, below, would it just leave everything else well alone (I got the impression from your post that once I’ve specified one custom route, I might have to let Ghost know what to do with everything else)? You mentioning the risk of some stuff “not being routed” gave me the heebie-jeebies! :grimacing:
collections:
  /courses/:
    permalink: /courses/{slug}/
    template: index
    filter: primary_tag:hash-courses

You would have to individually route pages up in the routes section.