Skip to content
Discussion options

You must be logged in to vote

In index.njk you are using {% for item in collections.posts.splice(-5).reverse() %}

splice() modifies the original array which Eleventy expects to be static. You almost certainly don't want this.
slice() however creates a shallow copy and returns a new array without altering the original.

Swapping splice() for slice() should resolve your issue.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@IAALAI
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by IAALAI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants