
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeLooking at your filter syntax, the issue is that you're trying to filter on a localized field structure. When you have a field like title that contains language-keyed objects, you need to filter differently.
Based on your examples, it seems you have a structure like:
title: [
{_key: "en", value: "English Title"},
{_key: "es", value: "Spanish Title"}
]The correct syntax to filter this should be:
return {
filter: `title[_key == $language]`,
params: {language: 'en'} // or whatever language you want
}The key difference is:
title[_key == $language] - This filters the array and returns matching elementstitle[_key] syntax doesn't work because you can't extract _key as an array like thattitle[]._key syntax treats it as accessing a property after array expansion, which isn't the right approach for filteringIf you're working with the @sanity/language-filter plugin or a similar localization setup, this pattern should work. Make sure you're also passing the params object with your language value.
If you're using this in a reference field filter in your schema, it would look like:
{
name: 'myReference',
type: 'reference',
to: [{type: 'myDocument'}],
options: {
filter: 'title[_key == $language]',
filterParams: {language: 'en'}
}
}For more on Sanity's localization approaches, check out the localization documentation.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store