< Jekyll on Windows

Following up on the last journal entry with installing Ruby and setting it up. This time it’s a quick guide so that when I forget things, I can refer back to this. Installing Jekyll on Windows is relatively simple as long you follow certain steps and installing the right packages via Ruby Gems.

If you have Ruby installed and configured, that’s one step nearer to having a Jekyll website, so you can go ahead and install the ruby gem package Jekyll with the code below:

1
gem install Jekyll

This in return will install the ruby gem Jekyll and allow you to start building Jekyll sites via the Command Prompt.

Build a Jekyll website

To start working on a Jekyll website, you would need to navigate in your Command Prompt to where you would want the website to be, and then enter the code below:

1
jekyll build project-name

What it will do is create a new folder where you have navigated to, and implant a basic Jekyll website inside the folder which you can develop with.

Looking at the Jekyll website locally

Since you have built a Jekyll website via the CLI with the jekyll build project-name command, now you can preview it locally in your chosen browser by using typing:

1
jekyll serve -w

The -w at the end of jekyll serve is to continously watch for changes being made to any of the Jekyll files. The default address for the Jekyll website will either be at localhost:4000 or 127.0.0.1:4000 in your browser’s address box. If you make any changes to the files inside the project folder and saved it in the process, the website will regenerate and present you with the updated changes when you refresh the browser.

It is relatively simple to keep changing things and seeing it for yourself locally before you can commit it online via either GitHub Pages or elsewhere with the contents of the _site folder being put on your own hosting package.

Putting the Jekyll site on GitHub Pages

Firstly, GitHub Pages has their own ruby gem package if you wanted to match what they currently support for using a Jekyll site. If you wanted to install the gem package then you would need to type:

1
gem install github-pages

This will include Jekyll, and it may be an older version from what has been provided via the default Jekyll ruby gem package. So I would not worrry about having two different versions of Jekyll ruby gem packages on your machine.

Secondly, if you do not have Python installed, then it may result in a build error as the default Jekyll settings use Pygments as a syntax highlighter which is based on the Python language/library. You can either install Python or use an alternative highlighter like Rouge which is based on Ruby instead.

Thirdly, it is a good idea to change it to Pygments before you commit to GitHub Pages if you go down the Rouge direction as it currently does not support Rouge until Jekyll is at version 3.0 which is very soon hopefully!