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:

gem 'jekyll-gist'

Install the bundle:

bundle install

You can also install the gem directly:

gem install jekyll-gist

Enable the plugin in _config.yml:

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:

{% 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.

Enjoyed reading this?

If you found this article helpful, consider supporting my writing. Every little bit helps keep this blog going.

← Back to all articles