Created
August 25, 2010 11:34
-
-
Save tatey/549325 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
# Specify a post's time in the YAML front matter. An in-hook | |
# guarantees we'll have all the post data before rendering the payload. | |
class TimeHook < Hook | |
safe true | |
sequences :in | |
def in(site) | |
site.posts.each do |post| | |
if post.data.has_key?('time') | |
post.date = Time.parse("#{post.date.strftime('%Y-%m-%d')} #{post.data['time']}") | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment