Moving Ghost posts under URL prefix

Suppose you want your pages to show up under /{slug} but want posts to show up under /post/{slug}. Ghost allows you to do this using the dynamic routing feature. The routes.yaml you want will look like this:


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

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

The only way that differs from the default is that the default permalink is /{slug}. Documentation is here:

My understanding is that the default collection remains under /, but now the URLs of each element in the collection is prefixed with /post/. That’s all fine and good, but pages will remain under /{slug}; incidentally, that’s exactly what I want, but nowhere in that routes.yaml is it clear that that’s what’ll happen. What’s more interesting is the question of how one would change that. Suppose you want pages to be under /page/{slug}. The documentation doesn’t mention the use case.

Published on February 10, 2020.