πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Using GROQ to fetch all items in a collection except the first one.

2 replies
Last updated: Oct 6, 2023
Hello, I am wondering if it's possible in GROQ to fetch all items in the collections without include the first entry? Is it possible to slice that way? For example, if I have a series of post that I ordered by their publish date, how would I get all of them besides the first one?
Oct 6, 2023, 9:20 PM
If you want to post your current query, that may help us be more specific, but generally, you can slice an array and use
[1..-1]
notation to return all but the first (zeroth) index.
Oct 6, 2023, 9:44 PM
Excellent, thank you very much, that worked great.
Oct 6, 2023, 9:50 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?