Skip to content

Instantly share code, notes, and snippets.

@sojourning
Created January 27, 2015 16:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sojourning/eb532e08b602f0204016 to your computer and use it in GitHub Desktop.
Save sojourning/eb532e08b602f0204016 to your computer and use it in GitHub Desktop.
Jekyll tag plugin for making links open in a new window. (not for Kramdown and HTML)
# _plugins/target_anchor.rb
#for post at http://blog.sojourner.co
require 'liquid'
# Returns a HTML achor tag with target="_blank"
module TargetAnchor
def open_in_new_window(input, url)
return '<a href="' << url << '" target="_blank">' << input << '</a>'
end
end
Liquid::Template.register_filter(TargetAnchor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment