Permalink
Browse files

ability to specify date: CURRENT_DATETIME in metadata config

  • Loading branch information...
darvin committed Jan 13, 2013
1 parent 8cfaa39 commit b22708a914386b454b169e3b5a6df586445f094f
Showing with 5 additions and 0 deletions.
  1. +5 −0 _includes/model.js
View
@@ -377,6 +377,11 @@ function emptyPost(user, repo, branch, path, cb) {
rawMetadata = cfg.prose.metadata[path];
try {
metadata = jsyaml.load(rawMetadata);
+ if (metadata.date=="CURRENT_DATETIME") {
+ var current = (new Date()).format('Y-m-d H:i');
+ metadata.date = current;
+ rawMetadata = rawMetadata.replace("CURRENT_DATETIME", current);
+ }
} catch(err) {
console.log('ERROR encoding YAML');
// No-op

0 comments on commit b22708a

Please sign in to comment.