There is a lot of buzz around building a static website and Static Site Generators, if you have been following this trend you definitely would have heard about Gatsby.
Today, We will learn about Gatsby and how to build a website using it.
What is Gatsby?
Gatsby is React based frontend framework for creating integrated static websites and apps.
Prerequisites
Before diving into building your Gatsby website you need Node and Git installed.
After that, we need to install Gatsby CLI
npm install -g gatsby-cli
This will allows us to quickly create Gatsby sites and run development commands.
Creating a Gatsby website
Now, open your terminal and run
gatsby new
This will walk you through a set of questions like site name, folder, cms, styling, and other plugins, Then type yes when prompted to confirm settings.
Running Gatsby for the first time
Once the installation is done go to your Gatsby website directory, in our case it is
cd first-gatsby-site
and run the following command to start the server
yarn develop
this will start the server, and by default, your website will be available on http://localhost:8000
the homepage content is available on src/pages/index.js
, you can start editing the content and the site will get updated in real-time as you save.
We are glad you took the first step in building your static website.
Feel free to explore your Gatsby folder structure till next time.