stakx-io / stakx

An opinionated, powerful, and simple static website generator built in PHP
https://stakx.io/
MIT License
15 stars 3 forks source link

Pagination for collections and datasets #72

Open allejo opened 6 years ago

allejo commented 6 years ago
---
permalink: /blog/categories/%{paginator.group}/

pagination:
  # (required) the 'collection' or 'dataset' that we'd like to go through
  collection: posts

  # (optional) will default to N; the amount of entries per page
  count: 5

  # (optional) behaves the same way as the 'where' Twig filter
  where: drafts == false

  # (optional) behaves the same way as the 'group' Twig filter
  group: category

  # (optional) self explanatory
  sort: date

  # (optional) ASC (ascending) or DESC (descending)
  order: ASC
---

{% for post in this.paginator.collection %}
    {{ post.title }}
{% endfor %}

this.paginator will contain the following:

The permalink will automatically append page-X/ for every page starting after 2. Whether or not this can be configured is to be determined.