What are we going to learn today
- where to store our code (github)
- how to edit our code (gitpod)
- a little bit about the Terminal
- nothing else needs to make sense today. In future classes we will circle back on all the confusing parts
Let’s get set up
-
signup for github
use your school email address
-
signup for gitpod
“signup with github”
go to github & create a new repo
- at the top right click the plus sign & then
new repo
- fill the form
- repository name:
class-notes
- then click
create repository
- repository name:
now open this repo in gitpod
- navigate to: https://gitpod.io/workspaces
- click
new workspace
- take the url of your github repo (something like
https://github.com/jdraths/class-notes
) & paste it in the form - press enter
it might take a while to load, but you should be taken to a gitpod url like:
https://jdraths-classnotes-vyq8gxqpi9i.ws-us62.gitpod.io/
ok, next, change your gitpod to dark mode
-
Click the settings wheel at the bottom left & then click
Color Theme
- choose any of the dark themes
-
Congrats, you’re a hacker now
Let’s build a blog
first something about Terminal
pwd
ls
Ok, let’s get create our blog via the Terminal
npx gatsby new class-notes https://github.com/gatsbyjs/gatsby-starter-blog
A directory mishap we need to fix
-
class-notes is the name of your gatsby blog…
- … but it’s also the name of our current directory… remember
pwd
- … but it’s also the name of our current directory… remember
-
once install is complete…
ls
again… now what- we have
class-notes
inside ofclass-notes
fixing our directory mishap
$ cd class-notes
$ pwd
# ⇒ /workspace/class-notes/class-notes
- see?
so we need to move everything in the second class-notes into the 1st class-notes… this is just something annoying about gatsby & gitpod not working well together…
- so, first cd back up one directory ⇒
cd ..
pwd
to see where you are… it should be/workspace/class-notes
- and if you
ls
thenclass-notes
should be the child folder…
mv class-notes/* .
- this means move everything in the
class-notes
child into the current directory (.
means current directory,*
means wildcard, aka everything)
- this means move everything in the
- now
mv class-notes/.* .
(notice the extra period this time)- this command moves hidden files… don’t worry about why yet.
- now
ls -a class-notes
to see if anything is still in the child (the-a
means all files including hidden files…)- as long as it’s empty then ⇒
rm -rf class-notes
to delete it
- as long as it’s empty then ⇒
ok, now we have one class-notes
folder without a child class-notes
. We’re cooking!
Let’s push our code up to github so that we save our progress
- if you see this in Source Control… that’s wrong… refresh your screen; I think we confused gitpod with the duplicate
class-notes
folders
commit & push (via the Source Control UI)
Go check out your github profile
it’s something like: https://github.com/jdraths
omg we have code on github…
omg our github profile shows some green boxes!
Ok, let’s run our blog locally
-
open
package.json
for a little familiarity- look at
scripts
&start
- (this is typical for react apps) - You’ll learn more about this later
for all the objects in
scripts
you can runnpm run [whatever]
… so rn, runnpm run start
- look at
NICE, now let’s start editing
^^^ New Beginnings, My Second Post! & Hello World… let’s change these
-
navigate to
content
folder -
let’s go to hello-world & change the file
other changes that should be made on your own or in future classes
- update gatsby-config attributes for
siteMetadata
,gatsby-plugin-feed
’stitle
, &gatsby-plugin-manifest
- update the favicon… need to google how to do this
- update
Seo title=
- add a createPost script - that should be it’s own blog post explaining this
- add an about me page
- styling changes… we have a post for this
- add emoji support… need to google this