06 Jun 2016
After an interesting experience using multiple languages and tools I never used before, behold, my github blog. Archive posts detail how I made this site so people can feel free to duplicate it.
For those who do not know me, I am Christopher Oswald, a graduate student at UNC: Chapel Hill studying educational psychology, measurement and evaluation. My focus is on self-regulated learning within the context of digital learning environments.
I am a hobbiest coder who can read and edit scripts easily but has some trouble creating scripts from scratch. I study machine learning and statistics and have a fair deal of skill in that area. Over the years I have gained some deep knowledge in many content areas, with my focuses being research methodology, media effects, how people interact with technology, how people think, and the history of psychology.
I created this blog to work on my writing, which needs improvement. In particular, my editing skills. I do not recall ever being properly taught grammar in English, but I did study it fairly deeply in Latin, so I transfer what I can over. I am now actively studying writing. Early entries in this blog may not be the best written, have errors I missed, or other oddities. I will try to fix them as I see them but this is a learning blog, so some will go live.
I plan to use this blog to talk about things that interest me and offload ideas I have. My interests are in data science, data analysis, data visualization, research methods, metascience and cognitive and social psychology, and digital education. Things I wish to offload are programs I find useful, methods of research that I wished I knew about before I stated graduate school and general life hacks I discovered over the years.
I hope to do a post a week to start, but may start slower than that as I am editing my thesis to send it out for a formal copyedit.
Anyway, I hope people enjoy this, and learn something useful from it.
Until next time,
Chris
13 May 2016
Now the blog is up and running, there was a short break of fixing various issues that cropped up. I then edited the blog entries to reflect these changes. To edit a blog just go to the posts folder of my repo and open the blog post file. Make your changes in the editor and hit commit. Or you can change the files on your computer and move them into the _posts folder to replace them.
Both of these will save a new copy of the file and pushes it to your live site. While this may not seem that interesting to many, what this also is doing is keeping track of all changes being made. Git and Github are version control systems, so this applies to the blog as well. If you change something and do not like it, instead of manually editing the changes to style or structure back you can just revert to an older version by hitting the history button on the Github editing page.
Now I all that was left to do was to get the archive page working. I replaced the temporary text I had with the following code.
---
layout: page
title: Archive
---
<ul>
{% for post in site.posts %}
{% unless post.next %}
<h3>{{ post.date | date: '%Y' }}</h3>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
<h3>{{ post.date | date: '%Y' }}</h3>
{% endif %}
{% endunless %}
<li>{{ post.date | date:"%b" }} <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
Now the Archive page will be an actual working Archive. Note to fellow coders. If you want to embed code from liquid, as I did here, you need use raw and endraw tags. See the github code for this page for the exact tag.
12 May 2016
To summarize the last posts, I started with an empty Github, copied a blog theme, changed the default information to my own and set up the site to support blog posts. This post will thus deal with creating and posting blogs.
I chose Github and Jekyll for my blogs because they used Markdown. Markdown is a simplified typesetting language. Whereas programs like Word require you to find the setting you need in one of the many ribbon bars, Markdown you can just type the code yourself. Since I have not memorized the coding yet, as simple as it may be, and I wanted a live previewer of what I was writing I downloaded Haroopad:
http://pad.haroopress.com/
This gives me a nice two column work environment, one where I type in my blog and format with Markdown and the second showing what it will look like when I publish it.
You can write the blogs straight in Github’s editor, but Haroopad gives me a nice insert option in case I forget the code to add formatting.
Now using this blog does require a certain naming convention. You must name files like this:
year-month-day-Title-Of-Blog.md
So year, dash, month, dash, day, dash, title of the blog with dashes between the words, and .md to make sure it saves in the Markdown format.
To finish the posts, add the following as a header:
---
layout: post
title: "Creating a Blog Part 1"
---
This tells the site to render the page with the post style instead of just displaying the raw HTML that builds it.
I like to check my final post over in Sublime text with a spell-checker, but those with better writing skills can skip this.
Now there are several ways to take your finished posts and move them to the blog. I take the easiest option and just upload them into the _posts folder in my Github repo for the blog. I open this in Github then can drag my posts from my desktop to the _posts folder. Later, I will start to sync them directly with Github for Windows but for now this is the easiest way.
Next post will finish the setup of the blog by fleshing out the Archive.
11 May 2016
With the last post, I detailed the preparation downloads, forking a style and editing my information into the blog. This post I will get more into setting up the blog itself.
Thus far, the blog is linked with our information, but the rest of the site is still based on the Hyde style page. So I needed to do a series of fast edits.
First for every item in the page_list I made last time I need to actually make a page for. This is where Jekyll and Markdown shine. I just had to go back to the Github repo and create a new file for each page I would make. So to create the About page, I created a new file and called it about.md.
Now I added the following code:
---
layout: page
title: About
---
Text goes here
This follows a simple format. For layout, you tell it you want to use the page style, as opposed to the post style that will be used for blog posts. The title is simply the title of the Page. Anything after the second dashed line will be displaced on the page. For now I used placeholders saying temp.
I repeated this for my CV, and the Archive page. The Archive page thus far is not functional, but I will discuss setting it up in a later post.
Now for some cleanup in the repo folder itself. I deleted the license.md file as I did not need this. The CNAME file I deleted and set up a redirect to my blog from my domain host on my domain hosting page. I edited the readme.md file to my name and the template for the blog I used. This page shows when people visit my Github repo on Github. Then I edited my 404 file for fun replacing the text there with some silly stuff.
With this the basic site is created. As a final step to prepare the site for blog posts of my own I go to the _posts folder of my repo and delete the three files there from the Jekyll blog.
Next post will detail how to first write and then post blogs.
10 May 2016
I decided that to practice my writing I would create a blog. I had a few blogs in the past but each one either required knowledge of HTML and CSS or used a template I had no control over. I had heard of people using Github to run blogs so I decided to give the blog another try.
Github blogs are not like traditional blogs. While there is the option to use HTML and CSS, there is also the option to run Markdown for the pages and Jekyll for the style. I encountered Markdown for R and really liked how simple it was to use, but Jekyll seemed really scary for someone who never got into the command line programming itself. Instructions said to use Cygwin to get Git, then Git to get Ruby, and then Ruby to get Jekyll. That was a whole lot of command line stuff and three languages before anything was done with making a blog. But it turns out I did not have to go that way.
First I decided to get the programs I would need in advance. I downloaded (or updated since I already had them) Sublime Text, Haroopad, and Github for Windows. Sublime Text I would use as my generic file editor and spell-checker, Haroopad for typesetting in Markdown as it has a live preview and Github for Windows to update my Github without having to go to the website repeatedly. Finally, I got a Markdown cheatsheet as it has been a while since I really used it.
http://media02.hongkiat.com/blogger-cheatsheet-resources/markdown-cheatsheet.jpg
The next step was to set up the blog space online.
Git, Rudy and Jekyll offered the complex, command line option but I found something simpler. Barry Clark had created a guide to create a Github blog, with almost no coding and my guide will follows his fairly closely:
https://www.smashingmagazine.com/2014/08/build-blog-jekyll-github-pages/
The first step was to find a Jekyll theme I wanted to use for my blog’s layout. I went to http://jekyllthemes.org/ and found Hyde which offered a nice column and page style I liked. Now to make this mine. I went the Github page for the style and forked it. Forking is a way of copying things in Github from someone else’s public account to your own. Now I had a copy of it in my own Github folder. Here I rename the repository (or repo for short) oswaldanalytics.github.io. Format for this is username.github.io. Now I am hosting an exact copy of the Hyde style page as my blog.
Next I needed to start editing stuff to make the page become my page. or at least have my information. The _config.yml file contains the information I would need to change to tell the blog who I was.
The file is fairly easy to understand. Look for information and change it out to my information.
# Dependencies
markdown: redcarpet
highlighter: pygments
# Permalinks
permalink: pretty
relative_permalinks: true
# Setup
title: Hyde
tagline: 'A Jekyll theme'
description: 'A brazen two-column <a href="http://jekyllrb.com" target="_blank">Jekyll</a> theme that pairs a prominent sidebar with uncomplicated content. Made by <a href="https://twitter.com/mdo" target="_blank">@mdo</a>.'
url: http://hyde.getpoole.com
baseurl: /
author:
name: 'Mark Otto'
url: https://twitter.com/mdo
paginate: 5
# Custom vars
version: 2.1.0
github:
repo: https://github.com/poole/hyde
After editing the file with my information it looks like this:
#Dependencies
markdown: kramdown
highlighter: rouge
# Setup
title: Oswald Analytics
tagline: A blog on academia, statistics, research and life.
description: A blog on academia, statistics, research and life.
url: http://oswaldanalytics.github.io
baseurl: /
author:
name: 'Christopher Oswald'
url: http://oswaldanalytics.github.io
paginate: 10
pages_list:
About: '/about'
Archive: '/archive'
CV: '/cv'
github:
repo: https://github.com/oswaldanalytics
Three other changes were needed. First I changed Markdown language to Kramdown and the code highlighter to Rouge. If you do not Github will gladly send hundreds of emails suggesting you do. Also I got rid of the lines about permalinks. Github also emails warnings about them. The rest is straight forward. Replace and add in your information. I removed somethings I did not use like twitter.
Now I created the column part of the blog. To do this I edited the page_list to what I wanted to be always accessible. I wanted an About section, my CV and what would later become an Archive for old posts.
When I was finished editing I hit commit, and the page changed looking more like a page of my own.
Next post I will discuss how to the pages that I wanted my blog to have.