Help needed with Next.js and Sanity integration, getting 404 error and build error
The “Site” field is hidden for users and auto populated via initial value templates
🙂
You can then make sure every reference field uses a “filter references” function like this one:
export const filterInternalLinkBySite = ({ document }) => {
if (!document?.sites) {
return {
filter: "",
params: "",
}
}
const siteIds = document?.sites.map((site) => site._ref)
return {
filter: "(count((sites[]._ref)[@ in $siteIds]) > 0) && _id != $id",
params: {
siteIds: siteIds,
id: document?._id,
},
}
}*[_type == "page" && $locale in sites[]->locale]Note both these examples have the site field as “sites” since some content might be usable on different sites, such as swedish content in swedish part of finnish page
😉
In addition you share the same media library which is usually nice
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.