Skip to content

Instantly share code, notes, and snippets.

@jonathanpenn
Created July 23, 2011 05:05
Show Gist options
  • Save jonathanpenn/1101042 to your computer and use it in GitHub Desktop.
Save jonathanpenn/1101042 to your computer and use it in GitHub Desktop.
class AbsPathTag < Liquid::Tag
def initialize(tag_name, src, tokens)
super
@src = src
@src.strip!
end
def render(context)
@base_url = context.registers[:site].config['url']
absoluteize(@src)
end
def absoluteize txt
@base_url + txt
end
end
Liquid::Template.register_tag("abspath", AbsPathTag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment