Anson LowZF Blog

moon indicating dark mode
sun indicating light mode

Learning Gatsbyjs Challenge 2

March 29, 2020 #Gatsbyjs, #100DaysOfGatsby

Challenge 2: Build and Deploy Your Gatsby Site

After surveying Zeit, Surge, Heroku, Google Firebase, I chose to host my blog on netlify.

Register your account with Netlify

It’s fairly simple to use,

1. Drag & drop to Netlify:-

Run

gatsby build && gatsby serve

Gatsby will build and host the blog in your local machine at port localhost:9000

If it’s successfully build and you could see your blog showing

Mostly probably, Netlify will successfully build your blog in their serve

Ctrl + c to close your local server

Open your directory where you save your file, you will see a public folder had been created by gatsby

gatsby public folder in directory

Then, drag and drop your public folder to the following section

netlify drop build folder

Draw back for this method is you need to run gatsby build and drop the public to netlify everytime you have a new update

2. Continue Deployment My Preference

create a new site from git

Choose your remote hosting

choose remote hosting

Authorize and login to your remote hosting account

Pick up the repository you want to link

choose remote hosting

Leave the default setting as above and deploy your site

This way of deployment, everytime you push your lastest change to remote master branch

Netlify will rebuild, update and deploy your new blog


A self-taught developer documenting and sharing his learning experience.
React.js • Gatsby.js • Next.js soon. More about me