Skip to content

Instantly share code, notes, and snippets.

@houkanshan
Created October 6, 2012 13:27
Show Gist options
  • Save houkanshan/3844941 to your computer and use it in GitHub Desktop.
Save houkanshan/3844941 to your computer and use it in GitHub Desktop.
gist in jekyll
# From https://github.com/mojombo/jekyll/issues/463
# but run error on my jekyll.
# add a comments to stop jekyll auto omit the 'script' end-tag
# usage {% gist gist_id %}
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
text = text.split(' ')
@text = text[0]
end
def render(context)
"<script src=\"http://gist.github.com/#{@text}.js\">//make jekyll happy</script>"
end
end
end
Liquid::Template.register_tag('gist', Jekyll::GistTag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment