Scrivito JS SDK 1.33.0 Released

Featuring placeholders for data items

Posted on June 14, 2023

Weaving data into website content using placeholders

Editors can now insert placeholders representing specific pieces of data into textual website content, e.g., for personalization purposes. When the website is then visited, these placeholders are dynamically replaced with data provided by the application. This makes it possible to complement CMS-based content with information related to the current user, account or context, i.e., names, email addresses, statuses, and the like.

For making such data available, the Scrivito SDK now offers the Scrivito.provideDataItem API.

Introducing data locators

This release introduces the new datalocator attribute type that enables editors to embed dynamic functionality into pages or widgets, i.e., integrate logic that previously required the help of a developer.

Data locators can be used in many ways. This release features the initial set of APIs for DataLocators that we are going to expand in the course of the next few releases. We are also working on further examples to show you what they are capable of.

Note that these APIs are still considered beta, meaning that we will try to keep them stable. However, we still may need to introduce some smaller breaking changes. For now, let’s address two of the many use cases for data locators, dynamic lists and personalization.

Dynamic lists

One of the use cases for data locators is building “list widgets” that enable editors to create dynamic lists of CMS content. When used inside such a list widget, a data locator allows you to choose the type of content the list should contain. For example, you could add a widget with a datalocator attribute to the overview page of a blog to create a dynamic list that displays pages of the “Blog Post” type.

Data locators also support filtering. If a website has multiple kinds of blogs, for example, you could specify that the list on the “Tech Blog” overview page should only include blog posts that have been tagged as “tech”.

Furthermore, data locators also let you limit the number of results in order to specify, for example, that at most ten blog posts are to be shown.

And finally, data locators support sorting, so you could have the blog overview start with the most recently published posts.

Personalization

The new datalocator type can also be used to implement functionality that makes use of “external” data sources rather than CMS content, e.g., data that is provided via the new provideDataItem API.

This enables editors to build widgets for website personalization, e.g., widgets that display content depending on specific conditions.

As an example, with the help of such a widget, you would be able to choose “Logged-in user” as the data source and then apply the “admin” is “true” filter to make a particular part of the content only visible if the user is an administrator.

Further improvements

Custom icons for the Content Browser

Locating and browsing assets of a specific type can now be made easier for editors.

Developers can now place any icon in the Content Browser filter section, meaning that providing visual clues is no longer limited to the predefined icons. See the API documentation for details.

Hot reloading of widgets

The support for “Hot Module Replacement (HMR)” in Vite and “Hot reloading” in Parcel has been improved so that they now also work for widgets.


Fixed link editor

Adding a new HTML link to text that already contains a link no longer causes nested or empty link tags.

Thank you for using Scrivito!