Skip to content

Instantly share code, notes, and snippets.

@thedod
Created April 1, 2015 09:45
Show Gist options
  • Save thedod/c7b2fd9c2844a604cf07 to your computer and use it in GitHub Desktop.
Save thedod/c7b2fd9c2844a604cf07 to your computer and use it in GitHub Desktop.
Dumbest possible Jekyll plugin: prefix site.baseurl
# {% site_url /some/path/to/file.suffix %} is like {{ '/some/path/to/file.suffix' |:prefix site.baseurl }}
module Jekyll
class SiteUrl < Liquid::Tag
def initialize(name, url, tokens)
super
@url = url
end
def render(context)
context.registers[:site].baseurl+@url
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment