Creating a Jekyll Theme: A Comprehensive Guide
O
Ohidur Rahman Bappy
MAR 22, 2025
Introduction
Learn how to create and publish your Jekyll theme by following this step-by-step tutorial. From installation to going live, we cover everything you need to know.
Installation
Jekyll is a Ruby Gem that can be installed on most systems.
Requirements
- Ruby version 2.5.0 or higher, including all development headers. Check your version with
ruby -v. - RubyGems. Check your version using
gem -v. - GCC and Make. Verify versions with
gcc -v,g++ -v, andmake -v.
Installing Ruby and Jekyll
The easiest way to install Ruby and Jekyll is by using the RubyInstaller for Windows.
- Download and install a Ruby+Devkit version from RubyInstaller Downloads. Use default options.
- Run
ridk installto install gems with native extensions. More info in the RubyInstaller Documentation. - Open a new command prompt, and install Jekyll and Bundler using:
gem install jekyll bundler - Check installation with
jekyll -v.
Getting Started
- Sign up at RubyGems.
- Initialize a new theme with:
jekyll new-theme your-theme-name - Edit the .gemspec file with your theme's details.
Use jekyll serve to preview your site as you develop your theme.
Testing Your Gem
To test your gem:
$ gem build YOURTHEME.gemspec
- Create a new Jekyll site:
jekyll new mysite - Add your gem to the Gemfile and update _config.yml:
gem "your-theme", path: "../your-theme/" theme: your-theme - Run:
$ bundle install $ jekyll serve
Visit http://localhost:4000 to verify.
Going Live
Once satisfied with your theme:
- Edit the .gemspec file.
- Build the gem:
$ gem build YOURTHEME.gemspec - Publish it:
$ gem push YOURTHEME.gem
Follow Semantic Versioning: MAJOR.MINOR.PATCH.
To remove a gem:
$ gem yank YOURTHEME
Congratulations! You've published a Jekyll theme. Consider sharing it on Jekyll theme sites by submitting a pull request.