mirror of
https://github.com/vale981/metalsmith-collections
synced 2025-03-05 17:31:38 -05:00
Merge pull request #22 from unstoppablecarl/master
Documented collection metadata feature.
This commit is contained in:
commit
d37546ddec
1 changed files with 30 additions and 1 deletions
29
Readme.md
29
Readme.md
|
@ -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`.
|
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
|
## CLI Usage
|
||||||
|
|
||||||
All of the same options apply, just add them to the `"plugins"` key in your `metalsmith.json` configuration:
|
All of the same options apply, just add them to the `"plugins"` key in your `metalsmith.json` configuration:
|
||||||
|
|
Loading…
Add table
Reference in a new issue