Best way to setup ghost with Github pages

I’m looking to set up ghost with gh-pages. Many methods online refer setup with buster. I’m having certain issues (like sitemap.xml is not setting up, blog is not being indexed by google). Is there any robust method provided officially by ghost ?

The closest thing that is officially provided by Ghost would be the gatsby-starter-ghost, which uses Gatsby as a static site generator and Ghost as a CMS - you can read about it here: Build A Custom Static Site With Headless Ghost + Gatsby

You could then look at the Gatsby docs to see how to deploy to GitHub pages, there’s an intro to it here: How Gatsby Works with GitHub Pages | Gatsby

Thanks, Gatsby seems very promising. I’m quite new, I am following the docs, I’ve added the deploy script to package.json located in current directory. My URL is username.github.io . When I run npm run deploy, I am getting this error
npm ERR! Failed at the ghost@2.18.2 deploy script 'gatsby build && gh-pages -d public -b master'.
I am not sure where to keep the username.github.io directory as well. Do we have to place inside current directory and how do i deal with this error ?
There seems to be an error with this deploy script. I ran the script gatsby build && gh-pages -d public -b master` , and I got the following error :

There was a problem loading the local build command. Gatsby may not be installed in your site's "node_modules" directory. Perhaps you need to run "npm install"? You might need to delete your "package-lock.json" as well.

I installed the gastby-cli and it’s now present in node_modules. How to deal with it ?

It sounds like you didn’t install the dependencies from package.json? I would try running npm install.

As for the username.github.io directory, I’m not sure - I would check out the repo for that GitHub - tschaub/gh-pages: General purpose task for publishing files to a gh-pages branch on GitHub the README or the issue tracker might have something useful!

I installed it using npm install.

I’m not sure what that means, did you run npm install gh-pages or did you run npm install in the gatsby-starter-ghost directory? The latter will read from your package.json and install all the packages listened under the dependencies key

What do I do with the username.github.io ? Do I git clone it or run gastby new username.github.io ?

I installed both dependencies, gh-pages and gastby-cli

Did you clone the gatsby-starter-ghost repo? If so you need to run npm install in there

1 Like

My blog is not being indexed for a really long time. I think sitemap.xml may be the reason for it (If there are other issues, please let me know). I’m quite new to this. How can i configure it? Google Search console says couldn’t fetch. I’m opening this thread as this is closed. I’m using ghost with Github Pages. My URL is https://prajjwal1.github.io
I’m using Ghost > 1.0

Ghost’s default frontend and the gatsby frontend both have the ability to generate sitemaps. I am not sure what you used to generate a frontend in GitHub, but it seems like it does’t support sitemaps.

I’m using gatsby. Following the instructions from ghost gatsby starter repo. After publishing it still says Error loading stylesheet: An unknown error has occurred (805303f4) https://gatsby.ghost.org/sitemap.xsl

This looks to me as if you didn’t update your siteUrl in the siteConfig.js. Also, are your .ghost.json values correct and point to your Ghost installation?

Thanks, it worked.

I am seeing a difference between how gatsby is creating static site and what ghost local server is showing. Like I’m not able to choose background cover, plus my featured post is showing up like all others, images are not showing up (when deployed to gh-pages). Is that how it is ?

Can I make it look like casper theme as ghost server shows ? This ghost-gatsby theme is quite different.

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