In my previous posts, I have shown ways to add a lot of metadata to a Jekyll blog’s posts. However, the use of the metadata shouldn’t be left just for the search engines and social network sites. You too can benefit from the added metadata many sites expose these days.

The Discourse project shows a “onebox” when a user posts a link in a discussion thread. This functionality is available as its own gem and because it’s in Ruby, it’s easy to integrate with a Jekyll blog as well.

The one assumption onebox makes that doesn’t really fit a blog is that it uses a whitelist. Below, the Liquid filter adds my own blog to the whitelist but for more general use I should override the whole whitelisting.

# onebox_filter.rb
require "onebox"

Onebox::Engine::WhitelistedGenericOnebox.whitelist << ""

module Jekyll
  module OneboxFilter
    def preview(url)


The example usage for the filter is that you can write in your article

{{ "" || preview }}

to get a preview.

Pretty neat. The downside in using a Liquid filter is that you’re mixing Markdown with Liquid markup which is not really optimal. A better solution would be to yet again extend Kramdown (or whichever converter you use) to support custom markup.

However, as you can see I have no event finished matching onebox’s built-in CSS with my site…