DEV Community

David Riches
David Riches

Posted on

Deploying your Gatsby.js site to Netlify.

I've built a few sites now using Gatsby.js, the fantastic static site generator tool based on React. When I first started out I hosted my sites on Github pages, which sometimes became tedious, I think i lost hours trying to make sure the pathPrefix was correct.

I eventually came across Netlify, a cloud based hosting provider and much more.

Screenshot of Netlify homepage

What i found remarkable was their free tier hosting which provides everything I needed.

Screenshot of Netlify pricing plans

So this guide is a top level look at hosting a personal portfolio site on Github/Netlify.

First things first, make sure you have your Gatsby.js project on Github.

Netlify screenshot for github

I've chosen Github here.

Select repo

Select which repository you would like Netlify to host, I've created a Gatsby demo here called davids-gatsby-site from the Gatsby starter kit.

Now Netlify should automatically detect our site is Gatsby.js and pre-populate the Basic built settings.

Netlify build settings

Pro tip: If we wanted to we can create a netlify.toml file, we won't dive into this today but one of the advantages of this are we can keep this in code.

Click Deploy.

Deployment will run in the background, then after a few mins it should be done.

Netlify deployment

There you have it, here you've deployed the site Gatsby.js site to Netlify.

Netlify done

Top comments (1)

Collapse
 
joeberetta profile image
Joe Beretta

Thank you for useful post ๐Ÿ™๐Ÿ‘