New in 1.39.0

urlForDataItem(dataItem, options)

Determines the URL of a data item.

The urlForDataItem function can be used with DataItem instances. It returns the URL of the dataItem’s details page.

[New in 1.46.0]If dataItem refers to a page object, i.e., is based on an object class for which a React component has been provided via Scrivito.provideComponent, urlForDataItem returns the URL to that page. For the Binary type, it returns the URL of the binary.

For a page object and Binary, it returns the same value as Scrivito.urlFor would.

For an application running under Node.js, not in the browser, the origin of the generated URL can be configured using Scrivito.configure. For instance, if the origin is set to https://mycompany.com, the URL resulting from the above call would be https://mycompany.com/order-details?order_id=EEDF141E81694518”.

Params

  • dataItem (Object) – A DataItem instance.

Returns

String – The URL of the page or details page of the model instance concerned, or null if no such details page exists.