Skip to content

Commit 45755de

Browse files
Haroenvleviem1
andcommittedMay 31, 2021
fix(drafts): avoid error due to missing dates(#178)
Resolves #177 Co-Authored-By: leviem1 <leviem1@users.noreply.github.com>
1 parent 2610333 commit 45755de

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎lib/jekyll/algolia/overwrites/jekyll-document.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ module Jekyll
55
class Document
66
# By default, Jekyll will set the current date (time of build) to any
77
# collection item. This will break our diff algorithm, so we monkey patch
8-
# this call to return nil if no date is defined instead.
8+
# this call to return nil if no date is defined and the file is not a
9+
# draft instead.
910
def date
10-
data['date'] || nil
11+
data["date"] ||= (draft? ? source_file_mtime : nil)
1112
end
1213
end
1314
end

0 commit comments

Comments
 (0)
Failed to load comments.