Creating My Personal Website With Gatsby and GitHub Pages

Here’s the repo for the website: https://github.com/2018kguo/2018kguo.github.io

Background

The old version of my website

Initial Setup

npm install -g gatsby-cli
gatsby new my-gatsby-website https://github.com/LekoArts/gatsby-starter-portfolio-cara
cd my-gatsby-website 
git remote add origin https://github.com/[user]/[user].github.io.git
git checkout -b dev
git branch master

Editing the Website

gatsby develop

Publishing Manually

npm install gh-pages --save-dev
{
"scripts": {
...
"deploy": "gatsby build --prefix-paths && gh-pages -d public -b master",
}
}
npm run deploy 

Adding Continuous Deployment

Workflow runs

Adding Google Analytics (Page Views & Traffic)

npm install — save gatsby-plugin-gtag
require(`dotenv`).config({
path: `.env`,
})
GOOGLE_ANALYTICS_ID=”UA-XXXXXXXXX–X"

I code stuff. 2018kguo.github.io