Building a blog with Jekyll

By Darren – April 5, 2011

I’ve decided to start a new blog that I’ll host myself using Jekyll.

This blog will focus on coding and other computer science topics.

Building a blog with Jekyll is a great exercise, especially for someone looking to learn web development. You’ll install a gem, you’ll create layout files, you’ll run your own local server — good stuff!

Here are the basics:
1) Install the Jekyll gem.

gem install jekyll

2) Create these files and folders in your blog’s folder:
config.yml, atom.xml, index.html, css, _layouts/default.html, _layouts/post.html, _posts/2011-04-05-building-your-blog.textile, _site/

The config.yml is optional. Mine is just one line:

markdown: rdiscount

That tells Jekyll I’m going to use Discount Markdown in my blog posts.

The atom.xml is for your RSS feed. The index.html is for your homepage where you’ll probably show all your blog posts.

The css folder is for your stylesheets.

The _layouts folder allows you to setup page formatting.

The _posts folder is where you keep your published your posts. I included a sample file name.

Lastly, the _site/ folder is automatically populated when you run the Jekyll server.

3) Run the Jekyll server like so:

jekyll —server

(That’s two dashes in front of server.)

The folder contains the HTML Jekyll generated for your blog.

You can host your Jekyll blog on GitHub Pages. If you do, include a .gitignore file that looks like this:

_site/

Github will automatically use Jekyll to process your blog.