Access admin panel with gatsby-plugin

Hi, this is my first time working with Ghost and Gatsby. The problem I’m facing is that I can’t access the admin panel. The configuration that I’m using is the Ghost-gatsby-starter from GitHub

The path that where I’m searching is /ghost/settings/general/ which gives me a response of 404. What do I need to change to access the settings? The documentation mentions that I should replace the contentApiKey with my personal credentials to display my own posts which makes sense. However, the credentials are located in the admin panel which I can’t access.

Hey @ludwigjo :wave:t3:

When you setup Gatsby + Ghost, then you probably installed Ghost somewhere (on a Server, locally, Ghost(Pro)). This is also the URL that you setup in your .ghost.json file as apiUrl. You basically just need to take that URL of yours and append /ghost to login to your Ghost installation.

The Gatsby starter by default fetches the content from https://gatsby.ghost.io which is only to show you some example content.

Hope that helps! :crossed_fingers:t3:

Hi, thanks for the reply. I tried to add the URL as the apiURL but it still doesn’t work. Im using a local server at localhost:8000. What should i use as the contentApiKey?

You can choose this tab

image

And then select Add custom integration

There you will find your contentApiKey

Okey, but my issue right now is that I can’t access the admin panel.

Your local Ghost installation is usually accessible via http://localhost:2358/ and the Admin at http://localhost:2368/ghost. Those two have nothing to do with Gatsby except that Gatsby is using the Content API to fetch the data from Ghost. This is what you set up in your .ghost.json file then: the information for Gatsby where to find your Ghost installation to fetch the data from.

Hey there, @Aileen

I’ve been trying to set up Gatsby + Ghost and I think I’ll have to point my domain to Netlify so I don’t get a subdomain.netlify.com. But when doing that I lose access to ghost admin panel.

This is an issue because ghost is on DO and gatsby is on Github + Netlify.

@vikaspotluri123 mentioned it about it here, but is there a guide on how this can be done?

Any in-depth guides/tutorials on this?

There are no guides/tutorials for this yet, as it’s a pretty fresh territory here.

What Vikas said is absolutely correct. I would reconfigure your current DO Ghost installation to run under a subdomain of the domain you’re planning to use. Here’s a topic on how to do that, but you’ll also find it in the Docs.

If you’d like to use https://example.com change the URL of your DO installation to be https://content.example.com or something like that. This way, your Content API URL will be https://content.example.com and you can access Ghost Admin with https://content.example.com/ghost

The you’ll point https://example.com to your Netlify site and you should be sorted.

1 Like

This is perfect. Thanks for pointing me in the right direction with the docs, @Aileen! :slight_smile:

This just hit me while trying it out on my local. Wouldn’t implementing this solution mean having my posts in two different locations: https://example.com (running on gatsby) and https://content.example.com (running ghost to access the admin panel)?

Also, I noticed that the routes configuration I setup on ghost don’t apply for the gatsby site. I’ve got a simple routing setup to route my /tag/tag-name to just /tag-name.

routes:
/:
template: homepage

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

The only possible solution I can think of to achieve this is setting up multiple gatsby sites for each tag, which I think isn’t a very clean implementation. And I’m not sure how the domain configuration would be setup in this case either. :thinking:

Any other workarounds that you folks can point me towards?

You should put your Ghost site into private mode so that the front-end isn’t accessible.

1 Like

Damn, I totally forgot about it. Silly me. :man_facepalming:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.