Jekyll Blogging

A Jekyll blog might be more complicated than other approaches but it also offers high flexibility and many features.

You can install it yourself with:

gem install jekyll


OSX users might need to update their RubyGems:

sudo gem update -system

Additionally there are many other options:

  • Using rdiscount or maruku
  • Using pygments for syntax highlighting
  • and this list could go on and on due to an amazing community support

For more information check the Jekyll Wiki


Posting with Jekyll doesn’t involve a nice interface but is still a lot more simple than other methods.

You can post with Markdown like me or use an alternative. Editing gets even better if you are on a Mac and you use a nice markdown editor like Mou.

This is how my Jekyll folder tree looks like:


This might seem intimidating initially but after you’ve wrapped your head around it should be easy to understand.


You can place any .html files in here and then include them anywhere you want with the following tag:

{ % include FILE_NAME.html % }

This is especially helpful if you want to example use Disqus in your blog. I’ve included the javascript code in a disqus.html file and whenever I want to use it I can simply include it with the above tag.


The files in here are going to be the basic building blocks of your site. At the top of this post:

layout: post

therefore i access the post.html file in _layouts. That post.html file is based of a default.html file. Therefore I don’t have to worry about any CSS or HTML after the site has been set up once.


All your posts go in here. Look at the end of this post to see how I have written this post.

Automatic Post Generation

thanks to Cody Krieger

Cody Krieger wrote a small little script:

 1 #!/usr/bin/env ruby
 3 # *********************************************
 4 # Jekyll Post Generator Awesomeness
 5 # by Cody Krieger (
 6 # *********************************************
 8 # Usage:
 9 # % ./newpost.rb POST NAME
11 if ARGV.empty? or ARGV[0].downcase == "--help" or ARGV[0].downcase == "-h"
12   puts <<-USAGE
14   Usage:
15   % ./newpost.rb POST NAME
17   USAGE
19   exit (ARGV.empty? ? 1 : 0)
20 end
22 class String
24   # from ruby on rails (
25   # activesupport/lib/active_support/inflector/transliterate.rb
26   def parameterize(sep = '-')
27     # replace accented chars with their ascii equivalents
28     parameterized_string = self.dup
29     # Turn unwanted chars into the separator
30     parameterized_string.gsub!(/[^a-z0-9\-_]+/i, sep)
31     unless sep.nil? || sep.empty?
32       re_sep = Regexp.escape(sep)
33       # No more than one of the separator in a row.
34       parameterized_string.gsub!(/#{re_sep}{2,}/, sep)
35       # Remove leading/trailing separator.
36       parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i, '')
37     end
38     parameterized_string.downcase
39   end
41 end
43 TEMPLATE = "template.markdown"
44 POSTS_DIR = "_posts"
46 # Get the title and use it to derive the new filename
47 title = ARGV.join(" ")
48 filename = "#{'%Y-%m-%d')}-#{title.parameterize}.markdown"
49 filepath = File.join(POSTS_DIR, filename)
51 # Load in the template and set the title
52 post_text =
53 post_text.gsub!('%%TITLE%%', title)
55 # Write out the post
56 post_file =, 'w')
57 post_file.puts post_text
58 post_file.close
60 puts "Successfully created file => #{filepath}"


./newpost.rb Test Post

chmod u+x newpost.rb might be needed in order for the script to be executable.

The script is going to look for a file named template.markdown in you Jekyll root directory. This template is a basic Jekyll post that you have to fill in with your content.

layout: post
title: %%TITLE%%
published: true
Hello, Jekyll!

More on this can be found at Cody’s Blog

And if you are a Physics Lover like me you can easily embed Maxwell’s equations with LaTeX.

You can also do some in-line equations, for example: \( P(E) = {n \choose k} p^k (1-p)^{ n-k } \). That way you can make your posts - whatever they might be about - look quite pleasing.

Using Latex like this takes a little more than just writing down normal latex code but I am going to cover that in another post. But basically I am just using the awesome MathJax javascript library.

Check out my tutorial on how I did it!

Math Magic

Post Scriptum

The best thing is that you can just use Github Pages to deploy your blog:

git push origin master

It is as simple as that and you are all set!

Check out the original markdown of this post here.

By Cecil Wöbker

I do science during the day and develop or design at night. If you like my work, hire me.

Feel free to follow me on Twitter or email me with any questions.