Skip to content

Instantly share code, notes, and snippets.

@adamwong246
Created August 29, 2014 00:24
Show Gist options
  • Save adamwong246/2d732c3537f4774334f6 to your computer and use it in GitHub Desktop.
Save adamwong246/2d732c3537f4774334f6 to your computer and use it in GitHub Desktop.
var fmh = merge(
frontMatter.loadFront(e),
{path: e}
); //=>
//{ date: Sun Aug 24 2014 17:00:00 GMT-0700 (PDT),
//tags: 'log',
//__content: '\n\nThis is my first post',
//path: './_src/_blog/1/index.md' }
var path_keys = path.relative('./_src/', e).split('/');// => ['_blog', '1', 'index.md']
var mid_hash = path_keys.reduceRight(function(p, c, i, a){
var b={};
b[c]=p;
return b;
}, fmh);
console.log(mid_hash); // returns { _blog: { '1': { 'index.md': [Object] } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment