Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Creating a custom input component to search for documents with the same language as the current workspace.

2 replies
Last updated: Apr 9, 2024
Hi all.
I'm looking to make a custom input component and trying to see if something like this is possible.

On my site, I'm currently using the
document localisation plugin in order to create a "multisite". Aka, one admin dashboard, three websites. The schema and structure is the same throughout all three sites.
What I'm wanting to create is a replica of the reference search component. However, I'd like to be able to only search for documents with the same language as the current workspace (the workspace and the language ID's are the same for each unique site).

It's a bit of a pain trying to link to say, the homepage, but having three distinct homepages popup every time you search.

Is there any way of doing this?
Apr 8, 2024, 7:58 AM
You’ll want to use a dynamic filter on your reference. If you’re using that plugin, you most likely have the
lang
set on the document, which will show up in the context that’s passed into your filter function.
Apr 8, 2024, 4:43 PM
Amazing thank you!!
Apr 9, 2024, 7:05 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?