Created
August 29, 2014 00:24
-
-
Save adamwong246/2d732c3537f4774334f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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