Category Archives: Ruby

Getting started with jekyll

GitHub pages, by default, uses jekyll and I wanted to get something running locally to test things.

Getting everything up and running

Let’s start by installed Ruby by going to RubyInstaller for Windows Downloads if you don’t already have Ruby and Gem installed.

Now go through the Jekyll Quick-start Instructions – I’ll list them here also.

  • gem install bundler jekyll
  • jekyll new my-awesome-site
  • cd my-awesome-site
  • bundle exec jekyll serve

So if all went well, the last line of these instructions will run up our jekyll site.

Testing our GitHub pages

  • Clone (if you don’t already have it locally) you repository with you GitHub pages
  • Run git checkout master, i.e. or where you store your markdown/html file content (in other words not the gh-pages branch if you’re using the standard master/gh-pages branches).
  • I don’t have a Gemfile, so in the root folder, create a file name Gemfile and here’s the contents (if you have a Gemfile add these two lines)
    source 'https://rubygems.org'
    gem 'github-pages', group: :jekyll_plugins
    
  • Run bundle install
  • Run bundle exec jekyll serve

Note: You can commit the Gemfile and Gemfile.lock files to your GitHub repository, these are not used by GitHub Pages.

After you’ve run up the server a _site folder will be created, these need not be committed.

Changing the theme

The first thing you might want to try is change the theme to one of the other supported themes. Simply open the _config.yml file and change the name of the theme, i.e.

theme: jekyll-theme-cayman

Other supported themes include

If you change the theme you’ll need to shut the server down and bundle exec jekyll serve which will run jekyll build and update the _site directory.