Fork me on GitHub

Seventeenth Class Notes

by Elliott Hauser

23 Oct 2013

Announcements

  • Github Milestones

This is a continuation of the projec

Jekyll customization

Github pages uses a variable baseurl in the _config.yml file to render your page at username.github.io/baseurl. This is cool and all, but it breaks links, including the CSS links, leading to a crappy looking site:

Anywhere there's a link we'll need to tell it to put the baseurl in by adding /fall2013 to the text. For instance, in the file _layouts/default.html, the CSS link that looks like this:

<link rel="stylesheet" href="/css/main.css">

Should look like this:

<link rel="stylesheet" href="/fall2013/css/main.css">

Then, Add this to your _config.yml file:

baseurl: /mysite   # this should be the name of your project.  Mine is "mysite"

What's the deal with {{ site.variablename }}?

Jekyll reads the _config.yml file and stores each entry as a variable available to us in {{ site.variablename. This is how we're able to populate the site with this changed data automatically. Edit some of the default items in the config file, restart (or start) Jekyll, and see where they pop up:

The default config: name: Your New Jekyll Site markdown: redcarpet pygments: true

Other cool stuff with Liquid

Check out how index.html builds a list of the post names. Can you modify this to do something cool?

Exercise Due Friday

1) Make your Jekyll site look and link correctly 2) Write a post on our class site describing how to make a Github Pages Jekyll site from scratch, with screenshots of your Jekyll site. A default site is fine, but bonus points if you jazz it up in your walk-through.

Elliott Hauser is a PhD Student in information science at UNC Chapel Hill. He's hacking education as one of the cofounders of Coursefork.org. Find Elliott Hauser on Twitter, Github, and on the web.
comments powered by Disqus