Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination for collections and datasets #72

Open
allejo opened this issue Jun 30, 2018 · 0 comments
Open

Pagination for collections and datasets #72

allejo opened this issue Jun 30, 2018 · 0 comments
Labels
Difficulty: Difficult Something that will take a weekend to fix or involves a lot of internal changes Feature: Planned The proposed feature has been accepted and is planned for the future Feature: Request The feature does not exist and this is a formal request for it to be added RFC We need feedback on a topic
Milestone

Comments

@allejo
Copy link
Member

allejo commented Jun 30, 2018

---
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:

  • collection - an array containing the contain batch for the current page
  • total - the number of pages
  • group - if collection items are being grouped, the current value
  • page - the integer of the current page number
  • prevPage - the integer for the previous page number of NULL if it's the first page
  • nextPage - the integer for the next page number or NULL if it's the last page

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

@allejo allejo added RFC We need feedback on a topic Feature: Planned The proposed feature has been accepted and is planned for the future Feature: Request The feature does not exist and this is a formal request for it to be added labels Jun 30, 2018
@allejo allejo added this to the v0.2.0 milestone Jun 30, 2018
@allejo allejo added Difficulty: Medium A fix that can be done with a couple hours of work Difficulty: Difficult Something that will take a weekend to fix or involves a lot of internal changes and removed Difficulty: Medium A fix that can be done with a couple hours of work labels Nov 5, 2018
@allejo allejo modified the milestones: v0.2.0, v0.2.1 Nov 20, 2018
@allejo allejo modified the milestones: v0.2.1, v0.2.x Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Difficult Something that will take a weekend to fix or involves a lot of internal changes Feature: Planned The proposed feature has been accepted and is planned for the future Feature: Request The feature does not exist and this is a formal request for it to be added RFC We need feedback on a topic
Projects
None yet
Development

No branches or pull requests

1 participant