Reader level: Introductory

Build a Gatsby website using the following command. This will start a server running at port 8000, navigate using your browser. You can also access the GraphQL query page at localhost:8000/___graphql.

gatsby develop 

Once you are done developing, you can build this website so it can deployed to a server such as Netlify or Gitlab pages.

gatsby build

Once you have the above you can go ahead and set up your Netlify account and link your current folder. Install Netlify cli tools if you do not have that on your system.

npm install netlify-cli -g

Login to your Netlify account using the following command

netlify login

Link your current folder. Keep in mind that you are pushing the contents of your ‘public’ folder when you deploy to Netlify. You can even drag and drop the contents of this folder into Netlify if you choose to do so.

netlify link

If you are uploading for the first time you have to initialize the site for Netlify as shown here

netlify init

Deploy Netlify site to test the version using the command below. This will prompt you for a folder, enter ‘public’ after you hav built the website using ‘gatsby build’

netlify deploy 

To deploy to production and view it, use the following command, the ‘open’ flag will open your new page for you

netlify deploy --prod --open