How I Setup This Blog
Setting up a blog hosted on GitHub Pages (like this one) can be done with only a GitHub account. Posts can be written in Markdown using github.com. To create the page you are reading now, I started by creating a basic Github Pages site.
One of the easiest ways to do that, is to fork the barryclark/jekyll-now repository (repo for short) on Github. Once I forked that repo, I renamed the repo from jekyll-now
to barnettjw.github.io
(the URL you used to get here).
This post is a detailed list of the steps I used to make this blog, it is divided into 2 parts, Basic Github Pages Setup and Setting up a Jekyll Local Development Environment. All you need is a Github account, if you don’t already have one, you can create one at github.com. On Github Pages all content is written using Markdown. If you are new to Markdown, or just need a refresher, you can check out this guide on mastering Markdown.
For basic Markdwon editing, you can use any Markdown editor which has a live preview function. If you choose to setup a Jekyll local development environment, I recommend using Atom with a few Markdown add-ons. Setting up a local development environment is optional, it essentially provides 2 extra features, easily editing themes and having draft posts, for that setup you will need a few more tools.
Basic Github Pages Setup
Creating a user-based github page
- Sign into your Github account
- Go to the barryclark/jekyll-now repository and click on the Fork button .
- In your new repository click Settings
- Rename your repository to
<github username>.github.io
- This naming scheme is required for GitHub to recognize your repository is a user GitHub pages repository, which is a prerequsite for using jekyll-now.
- Scroll down to Github pages section. You should see:
Your site is published at
https://<your github username>.github.io/
- Go to
https://<your github username>.github.io/
to check out your new site
Basic configuration
Now you can edit the _config.yml
right on Github and then commit the edits. In a few seconds your site will be updated. You can follow this up with editing about.md
and /_posts/2014-3-3-Hello-World.md
files. For your about page and first post respectively. Make sure to rename 2014-3-3-Hello-World.md
to the current date, sticking to the same format.
Setting up a Jekyll Local Development Environment
Now that you’ve got your GitHub pages site up and running you may want to setup Jekyll locally. There are 2 main use cases for setting up Jekyll locally, drafts and theming. If you want to style a theme without having to commit a file to Github after each CSS tweak. Also if you want to be able to preview your drafts you would need to do that locally.
Install Development Tools
- Install SourceTree
- I prefer SourceTree over Github Desktop because atom has between diagrams and statuses.
- Install Atom
- Install atom packages
- markdown-preview
- markdown-writer
- language-markdown
- Install atom packages
Install github-pages
ruby gems
- Install Ruby
gem install github-page
Local Setup
Clone your repository
- Open SourceTree
- Add your Github account
- Clone your
jekyll-now
repository - Click on
Open in File System
Launch Jekyll locally
- Open terminal / Powershell
- Navigate to location of your repository
jekyll serve --watch
- View http://127.0.0.1:4000 in your browser
Commit Files to local Git repository
- Open Atom →
Open folder
- select the location local of your repository
- Edit files
- Check out the changes locally
- Authorize GitHub for Atom
Packages Menu
→GitHub Package
→Toggle Git
- For each file
- Click
Stage file
- Enter commit message for the edits you made in step 3
- Click
Commit to master
- Click
Update live site using Git
- Open folder of your repository in Atom
Packages
→Command Pallet
→Git Push
- Wait a minute for Github Pages to re-build your site
- View
https://<your github username>.github.io/
in your browser to see your changes