Your first plugin
Plugins allow you to extend Jekyll’s behavior to fit your needs. There are six types of plugins in Jekyll.
Generators create content on your site. For example:
- jekyll-feed creates an Atom feed of blog posts.
- jekyll-archives creates archive pages for blog categories and tags.
- jekyll-sitemap creates a sitemap.
Converters change a markup language into another format. For example:
- jekyll-textile-converter converts textile to HTML.
Commands extend the
jekyll executable with
subcommands. For example:
- jekyll-compose adds subcommands for creating a post, page or draft.
Tags create custom Liquid tags. For example:
- jekyll-youtube embeds a YouTube video.
- jekyll-asset-path-plugin outputs a relative URL for assets.
- jekyll-swfobject embeds a SWF object.
Filters create custom Liquid filters. For example:
- jekyll-time-ago - The distance between two dates in words.
- jekyll-toc - Generates a table of content.
- jekyll-email-protect - Obfuscates emails to protect them from spam bots.
Hooks give fine-grained control to extend the build process. For example:
- jemoji Display emojis
- jekyll-mentions turns mentions @jekyll into links
- jekyll-spaceship - advanced example. Provides powerful supports for table, mathjax, plantuml, video, etc.
There are two flags to be aware of when writing a plugin:
A boolean flag that informs Jekyll whether this plugin may be safely
executed in an environment where arbitrary code execution is not
allowed. This is used by GitHub Pages to determine which core plugins
may be used, and which are unsafe to run. If your plugin does not
allow for arbitrary code execution, set this to
This flag determines what order the plugin is loaded in. Valid values
To use one of the example plugins above as an illustration, here is how you’d specify these two flags:
class UpcaseConverter < Converter
The guides help you with the specifics of creating plugins. We also have some recommended best practices to help structure your plugin.
We recommend using a gem for your plugin. This will help you manage dependencies, keep separation from your site source code and allow you to share functionality across multiple projects. For tips on creating a gem take a look at the Ruby gems guide or look through the source code of an existing plugin such as jekyll-feed.