{
"name": "docpad-plugin-paged",
"version": "2.1.4",
"description": "DocPad plugin which adds the ability to render a document out to multiple pages",
"homepage": "https://github.com/docpad/docpad-plugin-paged",
"keywords": [
"docpad",
"docpad-plugin",
"paging",
"pagination",
"paged"
],
"author": {
"name": "Ben Delarre",
"email": "ben@delarre.net",
"url": "http://www.delarre.net"
},
"maintainers": [
{
"name": "Ben Delarre",
"email": "ben@delarre.net",
"url": "https://github.com/benjamind"
},
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "https://github.com/balupton"
}
],
"contributors": [
{
"name": "Ben Delarre",
"email": "ben@delarre.net",
"url": "https://github.com/benjamind"
},
{
"name": "Benjamin Lupton",
"email": "b@lupton.cc",
"url": "https://github.com/balupton"
}
],
"bugs": {
"url": "https://github.com/docpad/docpad-plugin-paged/issues"
},
"repository": {
"type": "git",
"url": "http://github.com/docpad/docpad-plugin-paged.git"
},
"engines": {
"node": ">=0.4",
"docpad": "6.x"
},
"dependencies": {
"taskgroup": "~3.1.1"
},
"devDependencies": {
"coffee-script": "~1.6.2"
},
"main": "./out/paged.plugin.js",
"scripts": {
"test": "node ./out/paged.test.js"
},
"readme": "# Paged Plugin for DocPad\r\nThis plugin provides [DocPad](https://docpad.org) with Paging. Documents can declare a number of pages that should be rendered for the document, or a collection over which the document should be rendered repeatedly.\r\n\r\n\r\n## Install\r\n\r\n```\r\nnpm install --save docpad-plugin-paged\r\n```\r\n\r\n\r\n## Usage\r\n\r\n### Setup\r\n\r\nTo use, simply add `isPaged: true` to the meta data for any document that you want to be rendered with paging. You can then use `pageSize` or `pagedCollection` to instruct the plugin how many pages to generate from this document.\r\n\r\nIn documents that have paging enabled we can use the `@document.page` object to retrieve information about the current and total pages. The `page` object is of the form:\r\n\r\n```\r\n{\r\n\tnumber: 0,\t\t// current page number\r\n\tcount: 10,\t\t// total number of pages\r\n\tsize: 5,\t\t// expected number of documents per page\r\n\tstartIdx: 0,\t// document index for first document in this page\r\n\tendIdx: 5\t\t// document index for last document in this page\r\n}\r\n```\r\n\r\n### Paging Collections\r\n\r\nYou can generate pages over a collection by using the `pagedCollection` meta property. Simply specify the name of a collection and the plugin will use this collections length to calculate how many pages to generate from this document. So if your `posts` collection contains 5 documents, and you have specified a `pageSize` of 3 then the paging plugin will render 2 pages, the first with documents 0-2 and the second with the remaining 2 documents.\r\n\r\n### Example\r\n\r\nFor instance we could create the file `src/documents/index.html.eco` which contains something similar to the followìng:\r\n\r\n```\r\n---\r\ntitle: 'Home'\r\nlayout: 'default'\r\ntags: ['page']\r\nisPaged: true\r\npageOrder: 0\r\npagedCollection: 'posts'\r\npageSize: 3\r\n---\r\n<% posts = @getCollection('posts') %>\r\n<% for i in [@document.page.startIdx...@document.page.endIdx]: %>\r\n\t<% document = posts.at(i).toJSON() %>\r\n\t<%= document.title %>
\r\n\t\t