Written by Rodney BarnesSeptember 26, 2019
This tutorial will walk through the quickest way to get a blog up and running that uses Gatsby on the front end and NetlifyCMS to manage content. We'll be using a starter template and deploying through Netlify as it is a relatively friction-less process, and by the end you'll have a live website that you can begin tweaking to your own taste.
- Install Gatsby CLI (you will also need npm installed)
- An account with Netlify
- An account with Github
Helpful Resources and Documentation:
- Navigate to the gatsby-netlifycms-starter repo on Github.
- Scroll down to the 'Getting Started' section of the readme and click on the 'Deploy to Netlify' button.
- Click on the 'Connect to Github' button.
- Once authenticated, choose a repository name and click 'Save and Deploy'. Netlify will create a repo in your Github account with a copy of the files from the template, then automatically build and deploy that repo with a randomly-generated URL.
- While waiting for your site to deploy, open a terminal and navigate to the directory where you would like to host a local copy of the blog.
- Type in this command to clone your repo, replacing the account and repository names with your own:
$ git clone https://github.com/[GITHUB_USERNAME]/[REPO_NAME].git
- Once the files have finished copying,
cdinto the project directory and type
npm installto install the project's dependencies. This will take some time.
- Once Netlify has finished building and deploying the site, you should be able to navigate to the URL and explore the website.
- In order to access the CMS, you will need to set up Netlify Identity. You can follow the instructions here to do so.
- Setting up Netlify Identity will involve authorizing yourself as a user. You can use your credentials to sign in to the CMS.
- Once the dependencies have finished installing on your machine, you can type
gatsby developin your terminal to run your project in develop mode.
- Your project is now live and ready for you to begin customizing it.
This is a similar process to what I used to set up the New Developers website. While I had experience using Vue to build Single-Page Applications, I wanted to try using a static site generator as I had read that they're better-suited for our use case - serving up static content like blog and event posts. You can read more about how Gatsby works here, and here is the comment that made everything really click for me.
With my background in Vue I initially turned to VuePress but got stuck on an asyncronous call that didn't seem to work (and which, being pretty new to all of this, I found myself unable to debug) so I decided to cut my losses and dived into to world of React via Gatsby.
Please contact us if you get stuck with the walkthrough above or have any questions about it. If you're looking for an easy add to your portfolio or resume, we've got a list of issues on our Github repo you can try and pitch in on.