assemble-indexer

0.1.2 • Public • Published

assemble-indexer NPM version Build Status

Assemble plugin to add index views to template collections.

Install with npm

$ npm i assemble-indexer --save

Usage

var indexer = require('assemble-indexer');

API

indexer

Add addIndices to a templates collection that will add index views to the collection when given an array of pages.

Params

  • options {Object}
  • options.index {Object}: Optional instance of View to use as the basis for the index views being added. Required if createView is not passed on plugin or method options.
  • options.createView {Function}: Function to create a view instance for the index view being added. Required if index is not passed on plugin or method options.
  • returns {Function}: Function to use as a plugin for templates

Example

var archives = app.create('archives')
  .use(indexer())
  .addIndices(pages);

.addIndices

addIndices method decorated onto the given collection Iterators over a list of pages (built with list.paginate) and adds each page to the collection as a new index view

Params

  • pages {Array}: Array of pages return from list.paginate
  • opts {Object}: Method options to override plugin options. Will also be added to locals for each index view.
  • opts.index {Object}: Optional instance of View to use as the basis for the index views being added. Required if createView is not passed on plugin or method options.
  • opts.createView {Function}: Function to create a view instance for the index view being added. Required if index is not passed on plugin or method options.
  • returns {Object}: Returns collection to enable chaining

Example

collection.addIndices(pages, locals);

Related projects

  • assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… more | homepage
  • paginationator: Paginate an array into pages of items. | homepage
  • template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage
  • templates: System for creating and managing template collections, and rendering templates with any node.js template engine.… more | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Brian Woodward

License

Copyright © 2015 Brian Woodward Released under the MIT license.


This file was generated by verb-cli on September 20, 2015.

Readme

Keywords

none

Package Sidebar

Install

npm i assemble-indexer

Weekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • doowb