0.1.1 • Published 9 years ago

metalsmith-ids v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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-ids

Usage

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