mirror of
https://github.com/vale981/metalsmith-collections
synced 2025-03-05 09:21:39 -05:00
add collections dictionary to global metadata
This commit is contained in:
parent
c15a2c0ab7
commit
bd1d662b25
2 changed files with 12 additions and 1 deletions
|
@ -75,6 +75,15 @@ function plugin(opts){
|
|||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Add them grouped together to the global metadata.
|
||||
*/
|
||||
|
||||
metadata.collections = {};
|
||||
keys.forEach(function(key){
|
||||
return metadata.collections[key] = metadata[key];
|
||||
});
|
||||
|
||||
done();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ describe('metalsmith-collections', function(){
|
|||
.use(collections({ articles: {}}))
|
||||
.build(function(err){
|
||||
if (err) return done(err);
|
||||
assert.equal(2, metalsmith.metadata().articles.length);
|
||||
var m = metalsmith.metadata();
|
||||
assert.equal(2, m.articles.length);
|
||||
assert.equal(m.collections.articles, m.articles);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue