Learning Jekyll

27 February 2016 on jekyll. 3 minutes

My interest was piqued recently by Jekyll, the blog-aware static site generator. I’m always interested in learning new, interesting technologies, plus I’ve been thinking about rejuvinating my site for some time, which gave me the perfect excuse to install Ruby and fire it up.

I’m drawn to Jekyll as it seems to hit a sweet spot for me due to the following features:

Markdown

I love Markdown. Markdown is a lightweight markup language with a simple, unobtrusive syntax. It looks great and is easily readable in its plain text form but is also easily converted into HTML. I find that I am using Markdown more and more every day.

Jekyll posts and pages can be written in Markdown format as well as HTML. Markdown is also compatible with HTML, so if you ever get some “widget” code that you want to embed on your site you don’t need to convert it in any way - just copy and paste the code in and mix the two together.

Static site generation

Previously I’ve used Blogger, WordPress and Ghost to manage my site. Blogger and the hosted offerings of WordPress and Ghost are ok, but they just don’t give me the flexibility I feel I need to be able to modify my templates and get my site running exactly how I want - there’s always some kind of restriction. This led me to hosting WordPress and Ghost myself, which required a LAMP style stack or Node.js on a server somewhere which, while not exactly a problem, was an overhead that I could do without.

Jekyll generates static sites. It processes your pages, posts and templates and produces simple output in the form of HTML files, allowing you to serve them up from almost any kind of web server. Apache, Lighttpd and Nginx are all welcome here, or you could just upload your files to an Amazon S3 bucket and serve them directly from there… Jekyll doesn’t care. Serving static HTML is also highly efficient, though I don’t for a second imagine that my site would ever attract enough traffic to cause me a problem.

GitHub pages

Jekyll is used by GitHub for their Github Pages feature. This allows you to create or push a Git repository with your Jekyll site to them, which they will then build and host for free. You can use a github.io address or your own domain name. This is perfect for me, as it allows me to develop my site and write content locally whilst being able to maintain it from anywhere with an internet connection. It also means that I don’t have to worry about hosting fees, backups or versioning. People can also fork my code and set up their own site easily and they can raise bugs, feature requests and even submit their own fixes & features if they choose to.

Simple, flexible templating

Jekyll uses the Liquid library for templating. This is extremely easy to learn and so far seems fairly capable, especially with the filters that Jekyll supports natively. It has its quirks, but I have not yet come across something which I haven’t been able to do.

Syntax highlighting

Jekyll includes support for syntax highlighting of code snippets, which may come in handy for me, though I will probably lean more towards embedding GitHub Gists instead.

The result

After a few evenings reading and coding the result is this site that you’re reading right now. I started with the Strata design by HTML5UP, which comes as plain HTML with CSS and SASS source code (Jekyll can also compile SASS for you, by the way) and converted it into a bunch of templates and supporting files which can be used with Jekyll. You can find the code in my GitHub repository. CloudCannon already have a version of Strata in their GitHub account, but it does not offer what I consider the minimum set of functionality I require in a theme and besides that, what better way to learn than to implement everything from scratch?


Next

My Configuration-less Core Service Client

Often I have the need to create a Tridion Core Service client and connect with a content manager to retrieve information or make modifications. This is usually for some kind of one (or few) time query, update or maybe a quick PoC to see if something is even feasible or not. I prefer to do this is in a lightweight IDE (LINQPad) with a pre-saved query so that I can get into the code quickly without needing to set up a solution or project etc. in Visual Studio.