Learn how Scrivito CMS can help you deliver amazing digital experiences
See Scrivito CMS in action

Obj.onAllSites()

Returns a SiteContext for accessing CMS objects regardless of their site assignment. This function is only relevant if the Scrivito application makes use of the multi-site feature.

const onAllSites = Scrivito.Obj.onAllSites(); landingPages = onAllSites.where('_objClass', 'equals', 'LandingPage').take(); console.log(landingPages.map((page) => [page.siteId(), page.title()])); // => [['en', 'Welcome'], ['fr', 'Bienvenue'], ['de', 'Willkommen']]

Unlike Scrivito.Obj and Scrivito.Obj.onSite, Obj.onAllSites does not take account of the site assignment of CMS objects, meaning that, for example, subsequent searches based on the resulting SiteContext consider all CMS objects, independently of the site they belong to.

Returns

SiteContext – a SiteContext

Remarks

This site context is the only possible way to access an Obj within the siteForUrl callback.