Have Ghost CMS point to Gatsby Site

Hey!

I’m using a headless Ghost with a Gatsby site. In Ghost’s admin portal, it shows the default casper theme. Is there a way to have that point to my Gatsby app that’s on another port? Am I supposed to build Gatsby first?

The admin interface will show the URL configured in your config file (it’s just an iframe). I think you might find this thread useful:

Got it! Thanks you!

1 Like

Hey @jackhedaya & @vikaspotluri123 :wave:

I’ve just updated our docs to include a method of setting up redirects if you’re using Ghost as a headless CMS:

Example:

[
  {
    "from": "^\/(?!content/images)(.*)",
    "to": "https://staticsite.com/$1",
    "permanent": true
  }
]

You may also need to include the following in your static site headers:

Access-Control-Allow-Origin: *

Credit to @fedetibaldo for contributing to Ghost and extending the redirects functionality :rocket:

1 Like

Have my Gatsby site on port 8000 and Ghost on 2368:

Is there a way to have uploaded images hosted in the CMS? The featured_image link seems to be pointing to localhost:8000 for some reason when the images are being stored on 2368. I’ve tried using the redirects file above and without to no avail.

Thank you for all the help!

Did a little digging around and found this Gatsby plugin which should copy your Ghost images to the Gatsby build:

However it might be worth looking around for a more standard method :blush:

That’s an awesome plugin (which I’m definitely going to use) but was wondering how to get the image to be uploaded to the cms. The url seems to point to base_url instead of server. I’d like images to be saved in their original folder which was localhost:2368/content/<date>/image.png

I think an apology for my ignorance here is due.

Thanks for all the help!

1 Like