From 223dd4c846f9430ef87085418f2e178e53d83c1e Mon Sep 17 00:00:00 2001 From: Tommy Chen Date: Sat, 2 Mar 2013 19:17:34 +0800 Subject: [PATCH] Fixed processor #100 --- lib/plugins/processor/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/plugins/processor/index.js b/lib/plugins/processor/index.js index 063b4e26d2..2c9257cc43 100644 --- a/lib/plugins/processor/index.js +++ b/lib/plugins/processor/index.js @@ -118,7 +118,7 @@ var load = function(file, stat, extname, callback){ meta.source = source; meta.mtime = stat.mtime; meta.ctime = stat.ctime; - if (!_.isDate(meta.date)) meta.date = moment(meta.date, 'YYYY-MM-DD HH:mm:ss').toDate(); + if (meta.date && !_.isDate(meta.date)) meta.date = moment(meta.date, 'YYYY-MM-DD HH:mm:ss').toDate(); if (meta.updated){ if (!_.isDate(meta.updated)) meta.updated = moment(meta.updated, 'YYYY-MM-DD HH:mm:ss').toDate(); } else { @@ -439,6 +439,8 @@ extend.processor.register(/^[^_](?:(?!\/_).)*$/, function(file, callback){ var meta = results.check, _id = results.id; + if (!meta.date) meta.date = meta.ctime; + if (meta.permalink){ var link = meta.permalink;