What’s a Jekyll?

To some, Jekyll is a serial killer with medically-induced dissociative identity disorder. To others, it’s a blog-aware, static site generator. That means, it creates directories and html that allows you to easily build out a blog site (like this one).

Currently, at the time of writing, the latest stable version is 2.2.3, which comes loaded with a ton of nifty features like pagination and node integration.

It’s similar to what many call a Content Management System (CMS), but stripped down and made to enable the casual user. Jekyll achieves all of that using the awesome power of Ruby and the Liquid Templating System .

The Jekyll Logo

Install Rbenv + Dependencies

Jekyll is a Ruby gem, so, naturally, we need to install Ruby on our machine.

First, we install Ruby’s dependencies. Run the following from the Terminal,

  # update package lists
  sudo apt-get update

  # install dependencies
  sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

The first line will update your installed repositories to point to the latest versions (doesn’t install them though) of themselves and their dependencies.

Then, we will download a utility called rbenv. This is the easiest way to install Ruby.

  # change to home directory and download the repo
  cd ~/
  git clone git://github.com/sstephenson/rbenv.git .rbenv

  # add path scripts to the bash script
  echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
  echo 'eval "$(rbenv init -)"' >> ~/.bashrc

  # download a plugin into the rbenv plugins folder
  git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

  # add plugin to bash script and then reload bash
  echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
  source ~/.bashrc

Install Ruby + Ruby Tools

Now that Rbenv is installed, we can install Ruby with this line,

  # install ruby, replace <latest-stable-version> with the latest stable version
  rbenv install -v 2.2.3

  # set the version to be the globally used version
  rbenv global 2.2.3

  # verify ruby installed
  ruby -v

  # (optional) install Bundler to help with application dependencies
  gem install bundler

When running ruby -v, you should see output like ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux].

Install Jekyll

This part’s easy. Just run,

  gem install jekyll

Use Jekyll Commandline Tools

Jekyll comes with its own series of helpful utilities. The ones you need to get started are

  # create a new project
  jekyll new project_name

  # run a local server hosting the generated content
  jekyll serve

  # re-generate the static content whenever a file is changed
  jekyll serve --watch

  # build the Jekyll files into static content; outputs to `_site`
  jekyll build

And that’s it! You now have a Jekyll-generated blog. To learn how to customize it, there’s no better place than the Jekyll documentation.

Bonus: Hosting Your Blog on Github Pages

So, you’ve installed Jekyll and have your own Jekyll blog. Awesome. Now, how do you make it live?

If you’re looking to save money and not buy a domain, look no further than Github Pages (GP).

GP allows users to have their own custom domain at <your-name>.github.io. Not only do you get a custom domain, but you get to have commits racked up on your commit history (wow).

Bonus: Using a Custom Domain with Github Pages

If you thought Github Pages was easy, you’ll be delighted to know hooking up your domain is just as easy.

You just need to add a CNAME file with your domain as the content.

See here for more details.

Bonus: Modernizing Your Workflow with Grunt and Bower

You can read the full article here.

References

web linux ubuntu blog