# Best way to setup ghost with Github pages

**URL:** <https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368>\
**Category:** Developer help\
**Created:** [March 20, 2019, 2:14pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368 "2019-03-20T14:14:49Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 20, 2019, 2:14pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/1 "2019-03-20T14:14:49Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![egg](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/egg/32/1691_2.png) [@egg](https://forum.ghost.org/u/egg)\
**Post date:** [March 20, 2019, 2:45pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/2 "2019-03-20T14:45:32Z")

</div>

The closest thing that is officially provided by Ghost would be the [gatsby-starter-ghost](https://github.com/TryGhost/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](https://docs.ghost.org/api/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](https://www.gatsbyjs.org/docs/how-gatsby-works-with-github-pages/)

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 20, 2019, 4:21pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/3 "2019-03-20T16:21:43Z")

</div>

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](http://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 ?

---

<div class="post-metadata">

**Author:** ![egg](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/egg/32/1691_2.png) [@egg](https://forum.ghost.org/u/egg)\
**Post date:** [March 20, 2019, 4:50pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/4 "2019-03-20T16:50:50Z")

</div>

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](https://github.com/tschaub/gh-pages) the README or the issue tracker might have something useful!

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 20, 2019, 4:53pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/5 "2019-03-20T16:53:35Z")

</div>

I installed it using npm install.

---

<div class="post-metadata">

**Author:** ![egg](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/egg/32/1691_2.png) [@egg](https://forum.ghost.org/u/egg)\
**Post date:** [March 20, 2019, 4:55pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/6 "2019-03-20T16:55:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 20, 2019, 4:55pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/7 "2019-03-20T16:55:31Z")

</div>

What do I do with the [username.github.io](http://username.github.io) ? Do I git clone it or run gastby new [username.github.io](http://username.github.io) ?

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 20, 2019, 4:56pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/8 "2019-03-20T16:56:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![egg](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/egg/32/1691_2.png) [@egg](https://forum.ghost.org/u/egg)\
**Post date:** [March 20, 2019, 4:56pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/9 "2019-03-20T16:56:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 19, 2019, 5:19pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/13 "2019-03-19T17:19:10Z")

</div>

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](https://forum.ghost.org/t/google-search-console-cant-find-any-url-from-sitemap-sitemap-generate-http-and-not-https-urls/3601) is closed. I’m using ghost with Github Pages. My URL is [https://prajjwal1.github.io](https://prajjwal1.github.io)  
I’m using Ghost \> 1.0

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [March 20, 2019, 5:56pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/14 "2019-03-20T17:56:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 20, 2019, 7:23pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/15 "2019-03-20T19:23:08Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![Aileen](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/aileen/32/9846_2.png) [@Aileen](https://forum.ghost.org/u/Aileen)\
**Post date:** [March 21, 2019, 2:21am UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/16 "2019-03-21T02:21:40Z")

</div>

> [@Not being indexed by google](https://forum.ghost.org/t/not-being-indexed-by-google/6351/4):
>
> [XML Sitemap](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?

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 21, 2019, 3:00am UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/17 "2019-03-21T03:00:19Z")

</div>

Thanks, it worked.

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 21, 2019, 3:42am UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/19 "2019-03-21T03:42:56Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![divergence](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@divergence](https://forum.ghost.org/u/divergence)\
**Post date:** [March 21, 2019, 4:17pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/20 "2019-03-21T16:17:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [April 2, 2019, 5:19pm UTC](https://forum.ghost.org/t/best-way-to-setup-ghost-with-github-pages/6368/21 "2019-04-02T17:19:10Z")

</div>

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