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

This commit is contained in:
Daniel Hilgarth 2013-03-03 14:56:18 +01:00
parent 17c875f6f5
commit cc83501489
1 changed files with 4 additions and 1 deletions

View File

@ -79,12 +79,15 @@ module Jekyll
# 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