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


Returns a SiteContext for the site specified by its ID.

const frenchSiteContext = Scrivito.Obj.onSite('Bordeaux'); const wineBlog = frenchSiteContext.where('_objClass', 'equals', 'Blog').take(1);

Returns a SiteContext for accessing CMS objects belonging to a different site than the current one. Note that Scrivito.Obj only returns objects part of the current site.


SiteContext – a SiteContext


onSite can also be invoked on a custom class. The returned site context will additionally restrict returned Obj instances to those belonging to the class, similar to Scrivito.Obj (i.e. for get, all and where).

const News = Scrivito.getClass('News'); const frenchNews = News.onSite('fr'); const mostRecentFrenchNews = frenchNews.all().orderBy('published_at').take(1);

If an Obj is created using this site context, it belongs to the site of the site context.

const ProductPage = Scrivito.getClass('ProductPage'); const bikePages = ProductPage.onSite('bikes'); const newBikePage = bikePages.create({ batteryCapacity: '20 TWh' }); console.log('SiteId:', newBikePage.siteId()); // => SiteId: bikes