Continuing in our Jekyll series, we have already learned how to create a Jekyll site. And you will have noticed that the Jekyll site comes with a default theme. In this article, we’re going to show you how to change your Jekyll theme from the default to a theme of your choosing.
In order for this process to work correctly, make sure you have installed the most recent version of Ruby on your computer. Jekyll uses RubyGems to manage packages you may want to install. The theme, in this case, is a package we will grab for our site.
Shop Around for Themes
You can find hundreds of Jekyll themes on the RubyGems website searching for jekyll-theme. These are all themes that will work with your Jekyll site.
How to Change Your Jekyll Theme
Follow along with the steps below to see how you can use RubyGems to install a new Jekyll theme.
- Open your Gemfile
- Add the theme to the Gemfile
gem "jekyll-theme-example"
- Open your terminal
- Install theme using the following command
bundle install
- Add the theme to your
_config.yml
file
theme: jekyll-theme-example
- Run the build command
bundle exec jekyll serve
Now you should be able to navigate to your staging URL (https://127.0.0.1:4000/) to see the changes. Your new theme will load with the site.