Al Idian

Jekyll: An Incomplete Overview

2016-04-28

What is it?

Jekyll is a static website generator known for its tight integration with GitHub Pages. It converts dynamic content into web-friendly files (HTML, CSS, JavaScript) and uses no server-side language or database. Static websites and static website generators like Jekyll can be limiting, but when used for a suitable task, their benefits are numerous and clear.

Unlike non-static website platforms which process content and templates on every request, Jekyll does so only once, at the moment the code is compiled. At compile time, a complete, static website is generated and stored in the folder _site ready to be served by a web server.

This fundamental difference makes Jekyll websites, along with other static sites, inherently more performant and secure than their non-static counterparts. Since the entire website has already been pre-built and cached, the speed at which static websites are served is unmatched. And since there is no dynamic content and no database, there is not much you can hack on a Jekyll website.

Managing a Jekyll website

Note: This section is outdated.

This very website was generated by Jekyll. Although this site is intentionally bare bones in its UI, Jekyll websites don’t have to be. Like any other platform, Jekyll can make use of Twitter Bootstrap and other CSS frameworks, and even with its simplicity, Jekyll is compatible with the front-end magic applied to many modern websites.

With all its benefits, a static website is obviously no good if one needs to write it from scratch. Thus, a solid templating mechanism is essential. Jekyll’s templating capability is dependent on the Liquid templating language, which supports a good range of tags and filters. Liquid (along with Rouge or Pygments or one of many others) also allows syntax highlighting for code snippets. For example, shown below is an example of some code with syntax highlighting:

// Sample C# code with line numbers
int sum(int i, int s)
{
return i + s;
}

Jekyll and GitHub

GitHub Pages offers free website hosting geared towards project web pages and personal websites and blogs. However, the service they offer is limited to static sites — making it a great, low-cost (can’t beat free) hosting platform for Jekyll users. Static websites are easily managed using version control systems like Git. In fact in the case of GitHub Pages, the only way to push changes to your live website is to check in your code. It all fits together.