> ## Content Index
> Fetch the complete content index at: https://getpublii.com/dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# @pagination global variable

- URL: https://getpublii.com/dev/pagination-global-variable/
- Published: 2017-08-04T22:37:35.320Z
- Updated: 2024-02-08T09:37:46.545Z
- Description: Homepage, tag, and author pages support pagination. It is based on a few global variables and helpers. You can use pagination not only for creating…
- Author: Tomasz Dziuda
- Tags: Global Variables

Homepage, tag, and author pages support pagination. It is based on a few global variables and helpers. You can use pagination not only for creating pagination links, but also for a link with `rel="prev"` or `rel="next"` attributes.

-   **@pagination** - variable used to detect if pagination is available in the specific view. If false - there is no pagination in the current view,
-   **@pagination.context** - context of the pagination. Empty string for homepage, tag slug for tag pages, author slug for author pages,
-   **@pagination.pages** - array with numbers for each available page,
-   **@pagination.totalPosts** - total number of posts,
-   **@pagination.totalPages** - total number of pagination pages,
-   **@pagination.currentPage** - number of the current page,
-   **@pagination.postsPerPage** - number of posts per page,
-   **@pagination.nextPage** - number of the next page (or false if none exist),
-   **@pagination.previousPage** - number of the previous page (or false if none exist),
-   **@pagination.nextPageUrl** - URL to the next page (or false if none exist),
-   **@pagination.previousPageUrl** - URL to the previous page (or false if none exist).

An example of pagination for search engines with use of the global pagination variables:

```handlebars
{{#if @pagination}}
   {{#if @pagination.previousPage}}
   <link rel="prev" href="{{@pagination.previousPageUrl}}">
   {{/if}}
   {{#if @pagination.nextPage}}
   <link rel="next" href="{{@pagination.nextPageUrl}}">
   {{/if}}
{{/if}}
```

An example of a pagination link is available in **Partials -> pagination.hbs**
