Redirect posts to new permalink with date

I want my blog posts to have the year and month in their permalink.

Using dynamic routing I successfully made the change:

routes:

collections:
  /:
    permalink: /{year}/{month}/{slug}/
    template:
      - index

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

However existing content isn’t redirected. My understanding is that I have to use the redirects.json file, but how do I use /{year}/{month}/ in it?

Seems like you would need to add all existing posts manually in redirects.json. If the redirection was the other way, it would be possible to use some regex.

Oh ok, thanks :frowning_face:

I made a python script to generate the redirects.json file using Ghost’s content API.

I explained it all here: How to migrate Ghost (and Isso) to dated permalinks - Stan's blog

1 Like