From ae228705b26267bc750b1c75a0fcc3f2147f31db Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 29 Feb 2016 15:46:11 -0800 Subject: [PATCH] Document#date: drafts which have no date should use source file mtime --- lib/jekyll/document.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 10f1203e..6768fcf6 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -68,7 +68,11 @@ module Jekyll end def date - data['date'] ||= site.time + data['date'] ||= (draft? ? source_file_mtime : site.time) + end + + def source_file_mtime + @source_file_mtime ||= File.mtime(path) end # Returns whether the document is a draft. This is only the case if