Merge pull request #22 from unstoppablecarl/master

Documented collection metadata feature.
This commit is contained in:
Dominic Barnes 2015-02-06 20:36:31 -08:00
commit d37546ddec

View file

@ -64,6 +64,35 @@ My article contents...
All of the files with a matching `collection` will be added to an array that is exposed as a key of the same name on the global Metalsmith `metadata`.
### Collection Metadata
Additional metadata can be added to the collection object.
```js
metalsmith.use(collections({
articles: {
sortBy: 'date',
reverse: true,
metadata: {
name: 'Articles',
description: 'The Articles listed here...'
}
}
}));
```
Collection metadata can also be assigned from a `json` or `yaml` file.
```js
metalsmith.use(collections({
articles: {
sortBy: 'date',
reverse: true,
metadata: 'path/to/file.json'
}
}));
```
## CLI Usage
All of the same options apply, just add them to the `"plugins"` key in your `metalsmith.json` configuration: