Home How to create a blog with Jekyll and Chirpy
Post
Cancel

How to create a blog with Jekyll and Chirpy

This YouTube video on how to use Jekyll is excellent. The documentation is here, but a summary of the steps to get it up and running (and working with Cloudfare) can be found below.

1
2
3
4
5
6
7
8
9
sudo apt update
sudo apt install ruby-full build-essential zlib1g-dev git

echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

gem install jekyll bundler

Go the Chirpy quick starter repo and create a site based on that template. Go to workflows, disable the one they created (since we aren’t using Github pages). You can also create this as a private repo and not use the username.github.io naming convention for the repo suggested, since we are using Cloudfare for hosting instead.

Git clone the repo and check it starts:

1
bundle exec jekyll s

Hosting instructions can be found here. To follow those instructions, you will need to add the following at the top (just under source line) of your gemfile:

1
2
gem 'jekyll'
gem "jekyll-sass-converter", "~> 2.0"

You can now connect up your repo to Github, specify Jekyll, leave the defaults as they are, and then click deploy. It will work, but will take a few minutes.

The other way of doing it, which I prefer, is to build locally using this:

1
bundle exec jekyll build

This will create a directory called _site (it will actually already be there and be kept up to date if using jekyll s). Delete ‘_site’ from the .gitignore.

Go back to the build settings on Cloudfare. Remove the build command. Leave the build directory as _site. Now Cloudfare will skip the build but look in the _site folder for the build contents.

Git add, commit and push. This will trigger a new deployment on cloudfare automatically. Since you have added the build files, these will be served. This means cloudfare deployments take a few seconds, rather than a few minutes.

So that you don’t eat up all 500 of your free builds per month on cloudfare, it may be a good idea to disable automatic builds and trigger them manually if you are committing to github more frequently than you want to build.

This post is licensed under CC BY 4.0 by the author.