0.1.1 • Published 11 years ago
metalsmith-ids v0.1.1
metalsmith-ids
A Metalsmith plugin that assigns a numeric id on your files based on sort by a field (by default date).
Features
- assign numeric id
Installation
$ npm install metalsmith-idsUsage
var ids = require('metalsmith-ids');
metalsmith.use(ids());There are additional options with the following default values:
metalsmith.use(ids({
sortBy: 'date',
reverse: false
}));You could alter those options:
metalsmith.use(ids({
sortBy: 'counter', // sort by the custom field -counter- of each file
reverse: true // newest = 1, older = increase ID
}));CLI Usage
All of the same options apply, just add them to the "plugins" key in your metalsmith.json configuration:
{
"plugins": {
"metalsmith-ids": {
"sortBy": "date",
"reverse": true
}
}
}License
MIT