0.2.0 • Published 4 years ago

metalsmith-auto-collections v0.2.0

Weekly downloads
86
License
MIT
Repository
github
Last release
4 years ago

metalsmith-auto-collections

Automatically use metalsmith-collections. The collection name is equal to the parent directory of each file.

Installation

npm install metalsmith-auto-collections [-D]

Usage

const Metalsmith = require('metalsmith')
const collect = require('metalsmith-auto-collections')

const ms = Metalsmith(__dirname)

// add all files to a collection
ms.use(collect())

// use globs to only set certain files to a collection
ms.use(
  collect({
    pattern: ['**/*.md', '!*.md'],
  })
)

// pass settings to `metalsmith-collections`
ms.use(
  collect({
    pattern: '**/*.md',
    settings: {
      sortBy: 'date',
      reverse: true,
    },
  })
)

// pass collections to metalsmith-collections (for manual collections)
ms.use(
  collect({
    collections: {
      navigation: {
        sortBy: 'ordering',
      },
    },
  })
)

To see the available options, see the metalsmith-collections repo.

0.2.0

4 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago