Antony's Blog

Start a blog in 15 min.

May 28, 2020

How to start a blog in 15 min

Start with cloning the gatsby gatsby-starter-blog Template πŸ™ˆ

git clone https://github.com/gatsbyjs/gatsby-starter-blog.git

we got the template the next question is where to host, as hosting can be expensive and we are looking at a ~100-page static website. there is no need for hosting, here is where GitHub pages come to the rescue πŸ”₯. we will go in steps from now:

  1. Make a Github repo named username.github.io (this will be your domain) 🌏
  2. Then make a remote with this repo from the cloned directory
  3. The tricky 🎩 part is that GitHub only allows the master branch to launch the site (which means gh-page package won’t work 😒)
  4. But worry not I have found a work around, Initialize git in the public directory in the cloned repo, If public directory not found run:

    gatsby build

    and then

    cd public && git init
  5. Add this to β€œscripts” in package.json file. so that you can deploy changes with a single command npm run masterdeploy

    "masterdeploy": `gatsby build && cd public && git add . 
    && git commit -m 'default' && git push origin master`
  6. Make necessary changes to the repo to make it your own.
  7. run this in terminal

    npm run masterdeploy
  8. There is no step 8, You are all done

Happy blogging πŸ˜ƒ

I will put customization I made in a later post stay tooned.