Skip to content

Pagination size: 1 doesn't populate page arrays but returns single items #1372

Open
@SirePi

Description

@SirePi

Describe the bug
Setting size 1 in a pagination results in having a flat array instead of an array of arrays, as described in

To Reproduce
Use the following njk

---
pagination:
  data: testdata
  size: 1
  alias: posts
testdata:
  - itemkey1
  - itemkey2
  - itemkey3
---
{% for item in posts %}
{{ item }}<br>
{% endfor %}
<hr>
{{ pagination.pages | length }} pages

Change size to a value greater than 1 to have the correct behavior

Expected behavior
I expected to see one item and 3 pages with size 1, but apparently it returns "itemkey1" directly, without wrapping it in an array, with the result of having each character treated as a single item instead.

Screenshots
OK (size 2)
image

NOT OK (size 1)
image

Expected (size 1)
image

Environment:

  • OS and Version: Windows 10 64 bit
  • Eleventy Version 0.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-discussionPlease leave your opinion! This request is open for feedback from devs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions