You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pagination.md 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. +++
  2. title = "Pagination"
  3. weight = 30
  4. +++
  5. Two things can get paginated: a section and a taxonomy term.
  6. Both kinds get a `paginator` variable of the `Pager` type, on top of the common variables mentioned in the
  7. [overview page](@/documentation/templates/overview.md):
  8. ```ts
  9. // How many items per pager
  10. paginate_by: Number;
  11. // The base URL for the pagination: section permalink + pagination path
  12. // You can concatenate an integer with that to get a link to a given pagination pager.
  13. base_url: String;
  14. // How many pagers in total
  15. number_pagers: Number;
  16. // Permalink to the first pager
  17. first: String;
  18. // Permalink to the last pager
  19. last: String;
  20. // Permalink to the previous pager, if there is one
  21. previous: String?;
  22. // Permalink to the next pager, if there is one
  23. next: String?;
  24. // All pages for the current pager
  25. pages: Array<Page>;
  26. // Which pager are we on
  27. current_index: Number;
  28. ```
  29. A pager is a page of the pagination: if you have 100 pages and are paginating 10 by 10, you will have 10 pagers containing
  30. each 10 pages.
  31. ## Section
  32. A paginated section gets the same `section` variable as a normal
  33. [section page](@/documentation/templates/pages-sections.md#section-variables)
  34. minus its pages. The pages are instead in `paginator.pages`.
  35. ## Taxonomy term
  36. A paginated taxonomy gets two variables aside from the `paginator` variable:
  37. - a `taxonomy` variable of type `TaxonomyConfig`
  38. - a `term` variable of type `TaxonomyTerm`.
  39. See the [taxonomies page](@/documentation/templates/taxonomies.md) for a detailed version of the types.