0.1.0 • Published 9 years ago

metalsmith-collection-grouping v0.1.0

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

metalsmith-collection-grouping

A Metalsmith plugin for grouping collections by a property.

Installation

$ npm install metalsmith-collection-grouping --save

Usage

var Metalsmith = require('metalsmith')
var collectionGrouping = require('metalsmith-collection-grouping')

var metalsmith = new Metalsmith(__dirname)
  .use(collectionGrouping({
    posts: {
      groupBy: 'category',
      meta: 'posts/categories.json'
    },
    projects: {
      groupBy: 'year',
      meta: {
        2014: {
          title: 'Projects from 2014'
        },
        2014: {
          title: 'Projects from 2014'
        }
      }
    }
  })

The meta property can either accept properties inline or through a json file.

The groups will be available as part of the Metalsmith.metadata(), this plugin does not modify the collections, they will remain as-is.