Migrating to Gatsby with Ghost as a backend

We just updated our homepage to integrate the blog posts directly in the site. This was setup using GatsbyJS. However, now the posts are showing up in both the old blog and the new site.

Ideally we’d like to see permanent redirects setup for all the old blog posts to point at the new path. How are people handling this today? Is there an official way to do this or simply managed by us somehow?

If you have not changed the domain name, you just need to point the domain dns to the new server so the users that will connect to the site will be redirected directly to the new one.

Maybe set the old as a private site from the ghost backend

Well, in this case both domains still need to exist where they are today. For example we have this for the old blog domain:

https://blog.example.com/

and this for the new blog domain:

https://example.com/blog/

We need the old domain to stay the same so we can still login to admin and create and manage posts.

What I’m wondering is this:

Since the Gatsby integration was announced by both the Gatsby and the Ghost team, is there an official way to have our posts published in two locations by default. My hope was that there would be a setting in Ghost where you give a domain where posts are published and it would automatically handle the permanent redirects. I couldn’t find this anywhere… which makes me wonder how others are handling this situation (or maybe they are not handling it at all.)

I’ve never tried, but I think it’s easy to solve, upload your content to netlify by setting the new domain, while the second domain remains active and working including the beckend on the current server, without even putting it private.

In this way the posts are published simultaneously on both locations

Hi @NathanPalmer,

You can set up redirects, but you’ll have to do it for each post.

I’d do this a slightly different way.

  1. I’d point blog.example.com to Netlify, and keep the same URLs. Ensure you have a Gatsby plugin that publishes sitemaps, and send those to Google.
  2. For your admin back-end, I’d create an admin.example.com, and point that to your Ghost server.
  3. Turn off publishing on Ghost when you’re sure all the redirects work.

Oh and - if you don’t keep the same URLs, then you can set up a redirects file on Netlify.

Dana

Thanks for the responses. We don’t use Netlify so those options won’t affect us. But it’s good to see information about the redirects.json file. However, like you mentioned, that’s post-by-post and wouldn’t work very well for ongoing posts.