skipping related_posts when there is only one post.

Without this the Matrix class raises an error trying
to coerce nil into a Matrix.
This commit is contained in:
Jack Danger Canty 2008-12-10 12:02:02 -08:00
parent f5c727fadb
commit c31d676f0f
1 changed files with 2 additions and 1 deletions

View File

@ -96,6 +96,7 @@ module Jekyll
# #
# Returns [<Post>] # Returns [<Post>]
def related_posts(posts) def related_posts(posts)
return [] unless posts.size > 1
self.class.lsi ||= begin self.class.lsi ||= begin
puts "Running the classifier... this could take a while." puts "Running the classifier... this could take a while."
lsi = Classifier::LSI.new lsi = Classifier::LSI.new
@ -145,4 +146,4 @@ module Jekyll
end end
end end
end end