Permalink
Browse files

blog: Require posts to have a date

  • Loading branch information...
1 parent b919e29 commit 40f70673c65de19183bfd9e32151383d23e7edf1 @isaacs isaacs committed Jun 29, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 tools/blog/generate.js
View
@@ -72,6 +72,7 @@ function parseFile(file, contents) {
}, {});
if (post.status && post.status !== 'publish') return null;
post.body = c;
+ post.src = file;
return post;
}
@@ -93,7 +94,9 @@ function buildPermalink(key, post) {
data.post = post;
- var d = post.date = new Date(post.date);
+ if (!post.date) throw new Error('post date is required ' + post.src);
+ else post.date = new Date(post.date);
+ var d = post.date;
var y = d.getYear() + 1900;
var m = d.getMonth() + 1;

0 comments on commit 40f7067

Please sign in to comment.