I've been stuck for a while trying to optimise my groq query.
I have page content that contains an array objects (different languages).
I've been playing around in Sanity Vision to see how I can filter the output so that I only get the content in the correct language.
//query
*[_type == "home"]{
content[]{
"language": metaData.language ->.language,
},
}
// query result
"result":[
0:{
"content":[
0:{
"language":"en-AU"
}
1:{
"language":"th-TH"
}
]
}
]
I wanted to get just the 1 content that matches the language. I tried this but it didn't work
*[_type == "home"]{
content[]{
...,
"language": metaData.language ->.language,
},
}[0][content[].language == "en-AU"]
Does anyone know how?
Thank you!