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. 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. // Total number of pages accross all the pagers
  29. total_pages: 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.