Joint session with Vercel: How to build intelligent storefronts (May 15th)

GROQ: How to fetch all items except the first one using slice?

2 repliesLast updated: Nov 29, 2025

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?
AI Update

Yes, absolutely! GROQ's slice component is perfect for this. You can use array slicing to skip the first entry and get all the rest.

Here's how to do it:

*[_type == "post"] | order(publishDate desc) [1..-1]

This query:

The slice syntax in GROQ works like this:

The key thing to remember is that GROQ uses zero-based indexing, so:

So if you want everything except the first entry, [1..-1] or [1...] is what you need. Just make sure to apply your ordering before the slice, otherwise you'll be skipping the wrong item!

You can read more about pipeline components and slicing syntax in the GROQ documentation.

Show original thread
2 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions