Creating a New Jekyll Site

Creating a New Jekyll Site

As one of the first widely-adopted static site generators, Jekyll may feel a bit old-fashioned these days. Newer solutions like Astro provide more flexibility and much faster build speeds, but also come with greater complexity that often (for my small projects, anyway) isn’t needed. To me, Jekyll is extremely simple and straightforward to use, and it’s still a solution I turn to when I want a site that’s easy to build out and maintain. I can appreciate the fact that it’s a relatively mature system that, once you understand its quirks, basically just works.

These are the steps I go through to create a new Jekyll site, and some tips that have been helpful for me. This is mostly for my own reference, but I hope it may help someone else too!

First, you need to make sure Ruby is installed, as mentioned here:

Jekyll Installation

as well as Jekyll and Bundler:

gem install jekyll bundler

When I’m ready to make a new project, I go into the parent folder, open a terminal, and type jekyll new <new-site-folder-name> --blank.

This will create a new Jekyll site in a folder of that name, without any theme. (Plenty of themes are available, but I generally like to build out my own.)

cd into the new folder.

Then run bundle init to create a Gemfile.

Add some basic lines to the Gemfile to start off:

# frozen_string_literal: true
	
source "https://rubygems.org"
	
# gem "rails"
	
gem "jekyll", "~> 4.2"
	
gem "webrick", "~> 1.7"

Run bundle install and then bundle update to make sure you have the latest gems specified.

Then I initialize a new git repository (git init). I like to set up my .gitignore before doing anything else. To start, I add these lines:

.jekyll-cache
_site

Commit this first. (If you forget, you will be tracking the _site and .jekyll-cache folders, so you’d need to untrack them first with git rm -r --cached _site and git rm -r --cached .jekyll-cache.

Then run bundle exec jekyll serve to build and serve the barebones site locally. From here, have fun building it out!


© 2024 Jennifer Galas. All rights reserved.