{"category":{"version":"58810495d172b61b00d73859","project":"542fe92a5eceb608003fddc8","_id":"58810495d172b61b00d7385d","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-04T12:45:40.548Z","from_sync":false,"order":3,"slug":"helper-reference","title":"Helper Reference"},"parentDoc":null,"project":"542fe92a5eceb608003fddc8","user":"542c5cfcddd3190e00228849","version":{"__v":1,"_id":"58810495d172b61b00d73859","project":"542fe92a5eceb608003fddc8","createdAt":"2017-01-19T18:25:25.206Z","releaseDate":"2017-01-19T18:25:25.206Z","categories":["58810495d172b61b00d7385a","58810495d172b61b00d7385b","58810495d172b61b00d7385c","58810495d172b61b00d7385d","58810495d172b61b00d7385e","58810495d172b61b00d7385f"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"0.11.4","version":"0.11.4"},"_id":"58810495d172b61b00d73888","__v":0,"updates":["5436ef5bb7cf0e1c0020dcaf","5436f79cb7cf0e1c0020dce6"],"next":{"pages":[],"description":""},"createdAt":"2014-10-04T19:39:24.458Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"never","params":[],"url":""},"isReference":false,"order":44,"body":"[block:html]\n{\n  \"html\": \"<div class=\\\"github-deeplinks\\\">\\n    <a href=\\\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/server/helpers/pagination.js\\\"><i class=\\\"fa fa-github-alt fa-right\\\"></i>Source</a>\\n    <a href=\\\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/test/unit/server_helpers/pagination_spec.js\\\" class=\\\"fa fa-check-square-o fa-right\\\">Tests</a>\\n</div>\"\n}\n[/block]\nUsage: `{{pagination}}`\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Parameters\",\n    \"h-2\": \"Attributes\",\n    \"0-0\": \"[Output](/docs/helpers#section-output), [Template-driven](/docs/helpers#section-template-driven), [Ghost](/docs/helpers#section-ghost)\",\n    \"0-1\": \"n/a\",\n    \"0-2\": \"n/a\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n## Description\n\n`{{pagination}}` is a template driven helper which outputs HTML for 'newer posts' and 'older posts' links if they are available and also says which page you are on.\n\nYou can override the HTML output by the pagination helper by placing a file called `pagination.hbs` inside of `content/themes/your-theme/partials`. Details of the default template are below.\n\nThe data used to output the `{{pagination}}` helper is generated based on the post list that is being output (index, tag posts, author posts etc) and always exists at the top level of the data structure. \n\n## Pagination Attributes\n\n* **page** - the current page number\n* **prev** - the previous page number\n* **next** - the next page number\n* **pages** - the number of pages available\n* **total** - the number of posts available\n* **limit** - the number of posts per page\n\n## Default Template \n\nThe [default template](https://github.com/TryGhost/Ghost/blob/0.5.9/core/server/helpers/tpl/pagination.hbs) output by Ghost is shown below. You can override this by placing a file called `pagination.hbs` in the partials directory of your theme. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<nav class=\\\"pagination\\\" role=\\\"navigation\\\">\\n    {{#if prev}}\\n        <a class=\\\"newer-posts\\\" href=\\\"{{page_url prev}}\\\">&larr; Newer Posts</a>\\n    {{/if}}\\n    <span class=\\\"page-number\\\">Page {{page}} of {{pages}}</span>\\n    {{#if next}}\\n        <a class=\\\"older-posts\\\" href=\\\"{{page_url next}}\\\">Older Posts &rarr;</a>\\n    {{/if}}\\n</nav>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","excerpt":"`{{pagination}}` Helper - Output a pagination block","slug":"pagination","type":"basic","title":"pagination"}

pagination

`{{pagination}}` Helper - Output a pagination block

[block:html] { "html": "<div class=\"github-deeplinks\">\n <a href=\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/server/helpers/pagination.js\"><i class=\"fa fa-github-alt fa-right\"></i>Source</a>\n <a href=\"https://github.com/TryGhost/Ghost/blob/0.10.0/core/test/unit/server_helpers/pagination_spec.js\" class=\"fa fa-check-square-o fa-right\">Tests</a>\n</div>" } [/block] Usage: `{{pagination}}` [block:parameters] { "data": { "h-0": "Type", "h-1": "Parameters", "h-2": "Attributes", "0-0": "[Output](/docs/helpers#section-output), [Template-driven](/docs/helpers#section-template-driven), [Ghost](/docs/helpers#section-ghost)", "0-1": "n/a", "0-2": "n/a" }, "cols": 3, "rows": 1 } [/block] ## Description `{{pagination}}` is a template driven helper which outputs HTML for 'newer posts' and 'older posts' links if they are available and also says which page you are on. You can override the HTML output by the pagination helper by placing a file called `pagination.hbs` inside of `content/themes/your-theme/partials`. Details of the default template are below. The data used to output the `{{pagination}}` helper is generated based on the post list that is being output (index, tag posts, author posts etc) and always exists at the top level of the data structure. ## Pagination Attributes * **page** - the current page number * **prev** - the previous page number * **next** - the next page number * **pages** - the number of pages available * **total** - the number of posts available * **limit** - the number of posts per page ## Default Template The [default template](https://github.com/TryGhost/Ghost/blob/0.5.9/core/server/helpers/tpl/pagination.hbs) output by Ghost is shown below. You can override this by placing a file called `pagination.hbs` in the partials directory of your theme. [block:code] { "codes": [ { "code": "<nav class=\"pagination\" role=\"navigation\">\n {{#if prev}}\n <a class=\"newer-posts\" href=\"{{page_url prev}}\">&larr; Newer Posts</a>\n {{/if}}\n <span class=\"page-number\">Page {{page}} of {{pages}}</span>\n {{#if next}}\n <a class=\"older-posts\" href=\"{{page_url next}}\">Older Posts &rarr;</a>\n {{/if}}\n</nav>", "language": "html" } ] } [/block]