Skip to content

Instantly share code, notes, and snippets.

@sojourning
Created Jan 27, 2015
Embed
What would you like to do?
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