✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Issue with filtering a reference based on a language key in a Slack thread.

2 replies
Last updated: Mar 16, 2024
I would like to filter this reference based on a set language key, I'm not succeeding with the following, can anyone spot the issue?

return {
    filter: `title[_key] == $language`, // not working
    filter: `title[]._key == $language`, // not working
}
Mar 16, 2024, 5:59 AM
Please try
$language in title[]._key
.
Mar 16, 2024, 2:05 PM
Thanks
user A
That works!
Mar 16, 2024, 8:19 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?