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


The slug of the CMS object.

obj = Scrivito.Obj.root().children()[0]; console.log(obj.slug());

While navigating the content, Scrivito generates URLs for the page links. The path of such a URL usually contains the slug of the page and its ID, e.g. /the-little-prince-1234567812345678.

Feel free to override the default implementation of slug in order to customize the generated URLs (see below for an example).




Create a Page CMS object class with its own slug method:

const BaseClass = Scrivito.createObjClass({ attributes: { body: 'widgetlist', title: 'string', }, }); class Page extends BaseClass { slug() { return this.get('title').replace(/ /g, '-').replace(/[^\w-]+/g, ''); } Scrivito.provideObjClass('Page', Page);