If you’re looking for some help, it’s important to provide as much context as possible so that people are able to assist you. Try to always mention:
Hey there @Candykick . Looks like you’ve got the Gatsby front-end setup on your Netlify project but not linked it to your own Ghost site. Check out our developer docs on how to use our Gatsby starter with your own Ghost site:
It seems like you’ve only got the Gatsby project set up in your machine, not Ghost itself. Gatsby is only a renderer that pulls data from Ghost, so you have to have an existing Ghost running somewhere to pull data from.
By default the data is pulled from the “Ghost Gatsby Starter” website, but you can configure it to use your own Ghost site in .ghost.json
.
I can suggest two options for you:
Option one: Set up your Ghost on a free site like Heroku, using eg. this project. Create a new webhook, then edit your Gatsby site’s .ghost.json
to use [your installation].herokuapp.com
as a data source and re-deploy to Netlify.
Now you can access Ghost admin from [your installation].herokuapp.com/ghost
to modify content, and rebuild Netlify to update the site with the latest posts on your Ghost site. You might want to create a Netlify webhook on Ghost to update your Gatsby site whenever a change is made in Ghost.
This is what I’m doing for myself, with Ghost on Heroku and Gatsby here on Netlify.
Option two: The second option is to always build the site locally. Install Ghost locally using ghost install
, and link it with the Gatsby project by creating a new webhook and updating .ghost.json
to match. Then you can run gatsby build
and drag-and-drop the generated public/
folder to Netlify. But you’ll have to do this every time you make a change to the site.
Either way, you must have Ghost running by itself before you can connect Gatsby to it. Otherwise Gatsby will pull content from the demo starter site which you can’t modify.
Hope that helps. Let me know if you have any more questions!
3 Likes
@badrihippo Thanks for the write-up
A few questions:
- Would any of your options work to make Ghost 3.2.0 with Members feature ON work?
- Should the answer to 1. be yes, have you open sourced your approach?
- Should the answer to 1. be yes, have you, by any chance, written a tutorial?
Good Saturday ahead!
Hi @patghost,
Unfortunately, no. The members feature means the site renders differently depending on whether a user is logged in or not, which by definition cannot be a static site.
I think one workaround is to display public posts on the static site and redirect members to the main Ghost site for restricted content. There was some discussion on this elsewhere in the forum (which I can find for you if you want).
To answer your other questions, I do have an GitLab repo for my current setup, but haven’t open-sourced it since it has private information like API keys (at that time, I hadn’t figure out how to do configuration with environment variables instead). However there is a public repo for the upcoming edition of my site, which is built with Gridsome. It even has the Casper theme (albeit the old/Ghost 2.x version).
As for the tutorial, I don’t have any, but activating the Ghost3 repo by SNathJr is pretty straightforward. And to link Gridsome to Ghost, you just have to update the environment variables to match your Ghost site details and Admin API key (go to Settings → Integrations and set up a new API endpoint to generate one).
Hope that helps!
1 Like
thanks @badrihippo. It definitely helped, gave me some perspective. Will be exploring further.
Here’s to hoping that in the future we can host a “Members ON” implementation with Jamstack