Embed Responsively is a handy tool for converting media URLs into responsive markup. It ensures the YouTube video you embed in your post will fit the width of it’s container, rather than having it’s dimensions constrained by height and width attributes.

Responsive Embed

I rarely write any Ruby, and my recent foray into Jekyll gave me a good reason to go write something. Rather than visiting Embed Responsively every time I wanted to include a video in a post, I wanted Jekyll to generate the embed markup when the site is being built.

My first cut of this was to write a new Liquid Tag, which I passed the name of the source and the video identifier:

{% responsive_embed youtube dQw4w9WgXcQ %}

This solution worked, but I didn’t like including a custom tag in my content to achieve it, I wanted to use a valid URL. So I decided to write a Converter Plugin that replaces embedabble links:

[The Magic Is in The Process](https://vimeo.com/72040407?jekyll_embed)

The jekyll_embed GET parameter is the indicator for the plugin to replace this link with the embed markup.

I’ve created a gist that contains the plugin code and the embed templates. It’s working, but to my untrained Ruby nose, it’s a bit smelly. If you’ve any pointers to educate this Ruby novice please leave a comment here or on the gist.