Skip to content

Instantly share code, notes, and snippets.

@seraphyn
Forked from portwaypoint/youtube.rb
Created January 29, 2012 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seraphyn/1700388 to your computer and use it in GitHub Desktop.
Save seraphyn/1700388 to your computer and use it in GitHub Desktop.
Jekyll youtube liquid template tag. Use with {% youtube IDOFVIDEO %} ... Found http://www.portwaypoint.co.uk/jekyll-youtube-liquid-template-tag-gist/
module Jekyll
class Youtube < Liquid::Tag
@@width = 640
@@height = 510
def initialize(name, id, tokens)
super
@id = id
end
def render(context)
%(<iframe width="#{@@width}" height="#{@@height}" src="http://www.youtube.com/embed/#{@id}" frameborder="0" allowfullscreen></iframe>)
end
end
end
Liquid::Template.register_tag('youtube', Jekyll::Youtube)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment