Jekyll is known as a blog-aware static site generator. This means that you can easily create a blog structure without involving a database. Everything is managed locally, and then you upload a static site to your server or deploy it to a repository for it to be shared with the world.
Jekyll development in 2016 is a great place to be. Working with it on Linux makes things easy and fun… if you enjoy a minimal, text-based workflow, of course.
Chances are, if you’re a front-end developer, you spend a lot of time in a text editor anyway. CMS sites have their place and are very useful, but in many cases, you want a light site, that you can maintain without involving a database, plugins, and all the updates and things that come along with dynamic CMS websites.
Let’s get started.
Installing Jekyll and its dependencies
Jekyll has a few dependencies that you’ll need to meet before installing it. As per the Jekyll website, they are:
- Ruby (including development headers, v1.9.3 or above for Jekyll 2 and v2 or above for Jekyll 3)
- Linux, Unix, or Mac OS X (this post will cover working on Linux, Ubuntu to be exact)
- Python 2.7 (for Jekyll 2 and earlier)
Historically, this has been the trickiest part for me. The ruby version in the official sources is often older than what Jekyll needs, so you’ll need to make sure that you’re installing the correct one (1.9.3 minimum) in order for the rest of the installation to go smoothly.
You may prefer to use rbenv, or rvm, or to install ruby from source, but to keep things quick and easy, my go-to method is what travis-ci recommends:
$ sudo apt-get install python-software-properties $ sudo apt-add-repository ppa:brightbox/ruby-ng $ sudo apt-get update $ sudo apt-get install ruby2.1 ruby-switch $ sudo ruby-switch --set ruby2.1
This ensures that you have a version of ruby new enough to handle even the latest version of Jekyll, and installing via PPA makes things nice and simple.
RubyGems is a package manager for ruby that will allow you to install jekyll, github pages, and many other things. This one is pretty simple:
$ sudo apt-get install rubygems
nodejs is available in Ubuntu’s default repositories, so you can simply:
$ sudo apt-get update $ sudo apt-get install nodejs
…and you should be good to go. You can also install node package manager (npm) if you so desire. You don’t really require knowledge of nodejs to use Jekyll, but it won’t hurt.
If you’re doing web development on your Linux machine already, there’s a decent chance you have Python installed already (you can check using $ python -V), but if not, it’s just as easy as the others:
$ sudo apt-get install python
Moment of Truth
Now, if you made it through installation of all the dependencies, you should be ready to install Jekyll itself:
$ gem install jekyll
Once the installation completes, you’re ready to setup your first Jekyll site (will create a new jekyll site inside the folder name you specify in the command below):
$ jekyll new mysite $ cd mysite && jekyll serve
then navigate to localhost/mysite:4000 and start working on it.
Whether you want a minimal blog, or a full-fledged website, you can do it all with Jekyll. There are also some plugins that you can use to extend Jekyll to do some other things, and plenty of liquid tags that you can explore to make use of Jekyll’s built-in variables.
Look back here soon for more tips on working with Jekyll and how you can incorporate it into your workflow, or if you’re interested in having me build a site for you using Jekyll, visit the services page or contact me.