Test Enterprise-Class Web CMS Scrivito Free for 30 Days
Test Scrivito Free for 30 Days


The slug of the CMS object.

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

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);