Ronalds Vilciņš

Embedding GitHub Gists in Jekyll

The jekyll-gist plugin gives Jekyll a Liquid tag for embedding code from a GitHub Gist.

Add the gem to your site’s Gemfile:

Ruby
gem 'jekyll-gist'

Install the bundle:

Bash
bundle install

You can also install the gem directly:

Bash
gem install jekyll-gist

Enable the plugin in _config.yml:

YAML
plugins:
  - jekyll-gist

If you use a Jekyll version earlier than 3.5.0, the configuration key is gems rather than plugins.

You can now place a Gist in a page, post, or collection item with its ID:

Liquid
{% gist id %}

Replace id with the identifier from the Gist URL. The plugin generates the embed when Jekyll builds the site, which keeps the Markdown itself pleasantly small.

Filed under on

Last updated on

← Back to all articles