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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 page
  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 page.
  15. base_url: String;
  16. // How many pagers in this paginator
  17. number_pagers: Number;
  18. // Permalink to the first page
  19. first: String;
  20. // Permalink to the last page
  21. last: String;
  22. // Permalink to the previous page, if there is one
  23. previous: String?;
  24. // Permalink to the next page, if there is one
  25. next: String?;
  26. // All pages for the current page
  27. pages: Array<Page>;
  28. // Which page are we on
  29. current_index: Number;
  30. ```
  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.