Skip to content

Instantly share code, notes, and snippets.

@tatey
Created August 25, 2010 11:34
Show Gist options
  • Save tatey/549325 to your computer and use it in GitHub Desktop.
Save tatey/549325 to your computer and use it in GitHub Desktop.
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