Github Pages - Setup and Development
The following will serve as a self-reminder for how this blog was setup on Github Pages.
Setup Steps ¶
- Setup Local Development Environment
- Initialize with sample jekyll blog structure
- Created repo
<username>.github.io
- Push local repo to remote
- Update repo settings to enable Github Pages
Setup Local Development Evironment ¶
We need a couple things for Macos development:
- Homebrew
- Ruby
- xcode-select
- Gems: Bundler and Jekyll
Homebrew ¶
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Ruby ¶
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install ruby
$ ruby -v
xcode-select ¶
$ xcode-select --install
Gems: Bundler and Jekyll ¶
$ gem install bundler jekyll
Initialize with sample jekyll blog structure ¶
Installs default minimal theme, minima.
$ jekyll new dlstadther.github.io
Create repo <username>.github.io
¶
github.com
- New repository
- Repo metadata
- Repository name:
dlstadther.github.io
- Description:
Personal Webpage powered with Github Pages and Jekyll
- Public
- No initialization contents
- Repository name:
Push local repo to remote ¶
$ cd dlstadther.github.io/
$ git remote add origin git@github.com:dlstadther/dlstadther.github.io.git
$ git add . # bad practice, but notes intention
$ git commit -m "Initialize repo"
$ git push origin master
Update repo settings to enable Github Pages ¶
github.com/dlstadther/dlstadther.github.io/settings
- Enable Github Pages
- Source branch:
master
- Enforce HTTPS
Development Process ¶
Site Configuration ¶
bundle update
Post Writing ¶
As blog posts take awhile for me to write, a post will need to sit somewhere under version control where it will not be compiled and displayed with completed articles.
For this reason, a _draft/
exists.
I create a file with the following Front Matter contents:
---
layout: post
title: "Sample Draft Blog Post"
date: 2018-06-28
categories: setup guide notes
---
and save it with the title _draft/sample-draft-blog-post.md
.
Throughout the writing process, I will desire to see the compiled version of my work-in-progress. I am able to do so by the following:
$ cd dlstadther.github.io/
$ jekyll serve --drafts
then navigate to http://127.0.0.1:4000/
. When done in this “debugging” draft mode, just ctrl-c
to stop the jekyll process.
Once I reach contentment with a post, I update the Front Matter date to the current date and move the draft to posts with a modified filename.
$ mv dlstadther.github.io/_drafts/sample-draft-blog-post.md dlstadther.github.io/_posts/2018-07-20-sample-draft-blog-post.md
And of course add, commit, and push with git.
Then voilà, a new blog post!