Is it safe to change default routing?

I would like all posts on my site to be within /posts/ as opposed to straight off the root of the site

I’m pretty new to Ghost but i’ve been reading about URLs & Dynamic Routing along with Collections. Looking at the default routes.yaml I see:

collections:
  /:
    permalink: /{slug}/
    template: index

I changed this to:

collections:
  /:
    permalink: /posts/{slug}/
    template: index

Is there any negative interaction or potential future issues with tags and pages or if I want to add further sections eg /blog? is the logic of the ‘/’ collection having /posts/ in the permalink wrong? What about sitemaps?

These seem unaffected, but just want to be sure. Now when I browse my posts, I see /posts/ in the URL and it all seems to work fine.

A key reason to want to do this is for fine grained cache settings on CDN

Any tips on best practice here would be appreciated. I don’t want to have to rely on using a ‘posts’ tag for this, but I suspect this is not necessary

Thanks in advance

Dynamic routing is designed exactly for a use case like yours so there’s definitely nothing wrong with that! :slight_smile:

Just remember, if you’re looking to add more routes, the route a particular post gets is top-down (the first collection that matches the filter takes the post)

Thanks (again!) for the help

So in this case I was curious becuaes I changed the ‘/’ collection to go to ‘/posts/’

From a functionality perspective, it works fine, the links updated and so did the sitemaps. No navigation problems and the site is not yet public, so I don’t need to set up any redirects so that is all good

However with the same logic, say I wanted to add /blog and /whatever; how would I set those up and would it mean that I have to always apply the ‘blog’ tag for it to take that route?

I pretty much get the collections documentation but what I am not fully sure on his how to make sure that content gets the right route as tags can be easily forgotten

Not exactly, but yes. Since the filter parameter supports logic outside of tags, you can technically create routes based on other data. However, in practice, (internal) tags tend to be used since they allow you to categorize content. The filter paramater determines what collection a post belongs to.

Great! I will do a bit more reading. Internal tagging makes more sense now, think I just need to tweak a bit.