W3cubDocs

/Jekyll 4

Ruby 101

Jekyll is written in Ruby. If you’re new to Ruby, this page helps you learn some of the terminology.

Gems

Gems are code you can include in Ruby projects. Gems package specific functionality. You can share gems across multiple projects or with other people. Gems can perform actions like:

  • Converting a Ruby object to JSON
  • Pagination
  • Interacting with APIs such as GitHub

Jekyll is a gem. Many Jekyll plugins are also gems, including jekyll-feed, jekyll-seo-tag and jekyll-archives.

Gemfile

A Gemfile is a list of gems used by your site. Every Jekyll site has a Gemfile in the main folder.

For a simple Jekyll site it might look something like this:

source "https://rubygems.org"

gem "jekyll"

group :jekyll_plugins do
  gem "jekyll-feed"
  gem "jekyll-seo-tag"
end

Bundler

Bundler is a gem that installs all gems in your Gemfile.

While you don’t have to use Gemfile and bundler, it is highly recommended as it ensures you’re running the same version of Jekyll and its plugins across different environments.

Install Bundler using gem install bundler. You only need to install it once, not every time you create a new Jekyll project.

To install gems in your Gemfile using Bundler, run the following in the directory that has the Gemfile:

bundle install
bundle exec jekyll serve

To bypass Bundler if you aren’t using a Gemfile, run jekyll serve.

See Using Jekyll with Bundler for more information about Bundler in Jekyll and for instructions to get up and running quickly.

© 2020 Jekyll Core Team and contributors
Licensed under the MIT license.
https://jekyllrb.com/docs/ruby-101/