2017-10-01 03:51:43 +00:00
|
|
|
+++
|
|
|
|
title = "Pagination"
|
|
|
|
weight = 30
|
|
|
|
+++
|
|
|
|
|
2019-05-20 09:30:41 +00:00
|
|
|
Two things can get paginated: a section and a taxonomy term.
|
2018-07-16 08:54:05 +00:00
|
|
|
|
2017-10-01 03:51:43 +00:00
|
|
|
A paginated section gets the same `section` variable as a normal
|
2018-09-29 09:15:50 +00:00
|
|
|
[section page](./documentation/templates/pages-sections.md#section-variables) minus its pages
|
2019-05-20 09:30:41 +00:00
|
|
|
while both a paginated taxonomy page and a paginated section page gets a
|
|
|
|
`paginator` variable of the `Pager` type:
|
2017-10-01 03:51:43 +00:00
|
|
|
|
|
|
|
```ts
|
|
|
|
// How many items per page
|
|
|
|
paginate_by: Number;
|
2018-09-30 21:49:32 +00:00
|
|
|
// The base URL for the pagination: section permalink + pagination path
|
|
|
|
// You can concatenate an integer with that to get a link to a given pagination page.
|
|
|
|
base_url: String;
|
|
|
|
// How many pagers in this paginator
|
|
|
|
number_pagers: Number;
|
2017-10-01 03:51:43 +00:00
|
|
|
// Permalink to the first page
|
|
|
|
first: String;
|
|
|
|
// Permalink to the last page
|
|
|
|
last: String;
|
|
|
|
// Permalink to the previous page, if there is one
|
|
|
|
previous: String?;
|
|
|
|
// Permalink to the next page, if there is one
|
|
|
|
next: String?;
|
|
|
|
// All pages for the current page
|
|
|
|
pages: Array<Page>;
|
|
|
|
// Which page are we on
|
|
|
|
current_index: Number;
|
|
|
|
```
|
2018-11-29 19:24:45 +00:00
|
|
|
|
|
|
|
## Section
|
|
|
|
|
|
|
|
A paginated section gets the same `section` variable as a normal
|
2019-05-20 09:30:41 +00:00
|
|
|
[section page](./documentation/templates/pages-sections.md#section-variables)
|
|
|
|
minus its pages. The pages are instead in `paginator.pages`.
|
2018-11-29 19:24:45 +00:00
|
|
|
|
|
|
|
## Taxonomy term
|
|
|
|
|
2019-05-20 09:30:41 +00:00
|
|
|
A paginated taxonomy gets two variables aside from the `paginator` variable:
|
2018-11-29 19:24:45 +00:00
|
|
|
|
|
|
|
- a `taxonomy` variable of type `TaxonomyConfig`
|
|
|
|
- a `term` variable of type `TaxonomyTerm`.
|
|
|
|
|
2019-05-27 12:35:14 +00:00
|
|
|
See the [taxonomies page](@/documentation/templates/taxonomies.md) for a detailed version of the types.
|