March 30, 2009

Getting Started with Jekyll

Install jekyll

$ sudo gem install mojombo-jekyll -s -s

Setup a site

$ mkdir site
$ cd site

Make the base layout

$ mkdir _layouts

Create a file called base.html in site/_layouts:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
        <title>{ {; page.title }}</title>
        <div class="container">  
            { { content }}

Make an about page:

mkdir about

Create a file called index.html in site/about:

layout: base
<h1>Getting started with Jekyll</h1>

<p>I am not afraid of the command line</p>

Now you should be able to run jekyll from your site directory


If that works, try running the built in server and take a look

jekyll --server

And browse to http://localhost:4000/about

Add some style

Well that’s not very pretty, but shows that it works. Lets add some style. I like to use Blueprint CSS, so I will add that. Feel free to use your own stylesheets, but this will give you a good starting point. You can download them from their website, or use the following wget’s to just get up and running quick:

mkdir stylesheets
cd stylesheets
cd ..

Add some syntax highlighting

sudo port install py-pygments
cd stylesheets

Add a feed

In the root of your site folder, create an ‘atom.xml’ file with the following:

layout: nil
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">

  <link href="" rel="self"/>
  <link href=""/>
  <updated>{{site.time | date_to_xmlschema }}</updated>
    <name>Christopher Sexton</name>
  {% for post in site.posts %}
    <title>{{ post.title }}</title>
    <link href=""/>
    <updated>{{ | date_to_xmlschema }}</updated>
    <id>{{ }}</id>
    <content type="html">{{ post.content | xml_escape }}</content>
  {% endfor %}