Skip to content

Commit 89058e0

Browse files
committed
11ty/eleventy#2466 Add documentation for skip in pagination
The referenced PR adds the skip parameter and this one adds the required documentation. The "addedin" will probably need to be updated once the referenced PR got merged. Signed-off-by: Raphael Höser <[email protected]>
1 parent 171806f commit 89058e0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/docs/pagination.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,13 +723,46 @@ The above will iterate over a data set containing: `["item1 with a suffix", "ite
723723

724724
You can do anything in this `before` callback. Maybe a custom `.sort()`, `.filter()`, `.map()` to remap the entries, `.slice()` to paginate only a subset of the data, etc!
725725

726+
### Skipping Items {% addedin "2.0.0" %}
727+
728+
Sometimes you might want to skip some of the first items in your data (e.g. because you already show them somewhere else).
729+
730+
{% codetitle "YAML Front Matter", "Syntax" %}
731+
732+
```markdown
733+
---
734+
pagination:
735+
data: testdata
736+
size: 2
737+
skip: 1
738+
testdata:
739+
- item1
740+
- item2
741+
- item3
742+
- item4
743+
- item5
744+
---
745+
```
746+
747+
Paginates to:
748+
749+
{% codetitle "JavaScript Object", "Syntax" %}
750+
751+
```js
752+
[
753+
[ "item2", "item3" ],
754+
[ "item4", "item5" ],
755+
]
756+
```
757+
726758
### Order of Operations
727759

728760
If you use more than one of these data set modification features, here’s the order in which they operate:
729761

730762
* The `before` callback
731763
* `reverse: true`
732764
* `filter` entries
765+
* `skip` entries
733766

734767
## Add All Pagination Pages to Collections {% addedin "0.8.0" %}
735768

0 commit comments

Comments
 (0)