https://github.com/rbardini/metalsmith-collection-metadata
A Metalsmith plugin to add metadata to every file in a collection
https://github.com/rbardini/metalsmith-collection-metadata
collection metadata metalsmith metalsmith-plugin plugin
Last synced: 6 months ago
JSON representation
A Metalsmith plugin to add metadata to every file in a collection
- Host: GitHub
- URL: https://github.com/rbardini/metalsmith-collection-metadata
- Owner: rbardini
- License: mit
- Created: 2016-05-03T17:31:15.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-08-04T10:02:23.000Z (about 1 year ago)
- Last Synced: 2025-04-14T02:02:03.254Z (6 months ago)
- Topics: collection, metadata, metalsmith, metalsmith-plugin, plugin
- Language: JavaScript
- Homepage: https://npm.im/metalsmith-collection-metadata
- Size: 2.93 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
metalsmith-collection-metadata
==============================[](https://www.npmjs.com/package/metalsmith-collection-metadata)
[](https://david-dm.org/rbardini/metalsmith-collection-metadata)
[](http://standardjs.com/)A [Metalsmith](https://github.com/metalsmith/metalsmith) plugin to add metadata to every file in a collection.
Requires [metalsmith-collections](https://github.com/segmentio/metalsmith-collections).
## Installation
```
$ npm install metalsmith-collection-metadata
```## Usage
To add metadata to a collection, you must assign a metadata object to a property that points to the location of that collection. For example:
```js
import collections from 'metalsmith-collections'
import metadata from 'metalsmith-collection-metadata'metalsmith
.use(collections({
pages: 'pages/*.md',
posts: 'posts/*.md'
}))
.use(metadata({
pages: { type: 'page' },
posts: { type: 'post' }
}))
```Adds a `type` property to every file in the `pages` and `posts` collections.
## License
MIT