Skip to content

Instantly share code, notes, and snippets.

@ravasthi

ravasthi/postmore.rb

Created Feb 15, 2012
Embed
What would you like to do?
Adding "read more" to Jekyll
module Jekyll
module PostMore
def postmorefilter(input, url, text)
m = /(?<morestring><!--\s*more\s*-->)/.match(input)
if m
input.split(m[:morestring]).first + "<p class=\"more\"><a href=\"#{url}\">#{text}</a></p>"
else
input
end
end
end
end
Liquid::Template.register_filter(Jekyll::PostMore)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.