Using Jekyll and GitHub Pages

Install Jekyll, creating a Jekyll site and a GitHub Pages site

Published on updated on

Jekyll instalation

Jekyll needs Ruby and the documentation from GitHub Pages also recommends Bundler.

To install those on Ubuntu 20.04 execute:

sudo apt update && sudo apt install -y ruby-full ruby-bundler build-essential zlib1g-dev

Create a Jekyll site

Execute this script in an empty directory:

#!/bin/bash
set -e

bundle init
bundle config set --local path 'vendor/bundle'
bundle add jekyll
bundle exec jekyll new --force --skip-bundle .
bundle install

Serve the site with:

bundle exec jekyll serve

and open a browser to http://127.0.0.1:4000 to see it.

Create a GitHub Pages site

Execute this script in an empty directory:

#!/bin/bash
set -e

bundle init
bundle config set --local path 'vendor/bundle'
bundle add github-pages
bundle exec jekyll new --force --skip-bundle .
bundle install

Serve the site with:

bundle exec jekyll serve

and open a browser to http://127.0.0.1:4000 to see it.

Notes

GitHub Pages information

Creating a GitHub Pages site with Jekyll is wrong or incomplete.

Building the site like is written there, as of 2020-06-03, will not work.

Gem path configuration

Using the command:

bundle config set --local path 'vendor/bundle'

will set path only for the current application. The setting is stored in the .bundle/config file, in current directory.

To set path for all bundles executed as the current user use:

bundle config set path 'vendor/bundle'

The setting is stored in the ~/.bundle/config file.

To see all settings use bundle config list command.

Update the gems

Go to your site’s directory where Gemfile is located and execute bundle update command.