Skip to content

Instantly share code, notes, and snippets.

@ravasthi
Created February 15, 2012 20:09
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 ravasthi/1838685 to your computer and use it in GitHub Desktop.
Save ravasthi/1838685 to your computer and use it in GitHub Desktop.
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