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.6KB

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