Permalink
Browse files

Fix broken post_url with posts with a time in their YAML front matter.

  • Loading branch information...
1 parent 17c875f commit cc83501489c41c96b35ea26b55f7df31faf65dee @dhilgarth committed Mar 3, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/jekyll/post.rb
View
@@ -79,12 +79,15 @@ def read_yaml(base, name)
# Compares Post objects. First compares the Post date. If the dates are
# equal, it compares the Post slugs.
+ # This comparison is used to create internal links using post_url.
+ # Post filenames are without a time, but the date property in the YAML
+ # front matter can be with time, so we compare only the date here.
#
# other - The other Post we are comparing to.
#
# Returns -1, 0, 1
def <=>(other)
- cmp = self.date <=> other.date
+ cmp = self.date.to_date <=> other.date.to_date
if 0 == cmp
cmp = self.slug <=> other.slug
end

0 comments on commit cc83501

Please sign in to comment.