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

Scrivito 1.1.0 Release Notes


Introducing faceted search

The Scrivito SDK now lets you do faceted searches for having search results categorized, for example. By using specific properties, e.g. the product vendor in a shop application, you can now offer your visitors a means to quickly narrow down what they are looking for. Faceted search also covers generating tag clouds dynamically, or providing auto-completion to editors. Here's an example showing how to determine the eight tags most often given to downloads as well as the three languages most often assigned to CMS objects of this class:

Obj.where("_obj_class", :equals, "Download").facet(
  tags: {limit: 8},
  language: {limit: 3})

There are two flavors of faceting, the one exemplified above, for specifying up to ten attributes, and a single-attribute variant that lets you specify the attribute and the options directly:

Obj.all.facet("tags", limit: 100)

You can have the matching CMS objects included in the search result. For details, please refer to the API documentation.

Freely customizable routing

In addition to providing the slug method, which lets you customize the URLs under which your pages are available, Scrivito now gives you full control over the routing it adds to your application. For this, the new scrivito_route API is available. An example:

  scrivito_route '(/)(*slug-):id', using: 'slug_id', via: :all

For usage examples or details regarding the parameters of scrivito_route, please refer to the provided documentation.

How to upgrade your application

The routing you are familiar with from previous Scrivito versions remains functional, and there is no need for immediate action. However, customizable routing will be the default in the next major version, and we therefore recommend upgrading your application. The first step is to enable customizable routing by disabling the routes Scrivito injects into the application:

Scrivito.configure do |config|
  config.inject_preset_routes = false

Then, append the following lines to your config/routes.rb file:

scrivito_route '/', using: 'homepage', via: :all
scrivito_route '(/)(*slug-):id', using: 'slug_id', via: :all

# The following line can be deleted if the application never used the legacy ID-first routing
get '/:id/:slug', to: redirect('/%{slug}-%{id}'), constraints: { id: /\h{16}/ }

scrivito_route '/*permalink', using: 'permalink', format: false, via: :all

Your routing should now work as before and can easily be customized to fit your needs.

Legacy routing

With the introduction of the new routing API, the legacy_routing configuration has been deprecated. This option enabled the old ID-first routing. However, this old behaviour can be easily reestablished using the new scrivito_route API:

scrivito_route '/', using: 'homepage', via: :all
scrivito_route '(/):id/*slug', using: 'slug_id', via: :all
scrivito_route '/*permalink', using: 'permalink', via: :all

New default HTML editor

As promised recently, MediumEditor now is the new default for editing HTML markup in WYSIWYG mode.

You can still go back to Redactor by specifying use("redactor") in scrivito.select_editor. Alternatively, add the editor: "redactor" option to an individual scrivito_tag.

Auto-completion for string lists

Auto-completion is an often requested feature, so we provided the in-place editor for attributes of the stringlist type with this functionality. It is the default editor for such attributes, meaning that auto-completion is available for them out-of-the box.

Currently, auto-completion is based on a best-effort approach to finding the 100 most popular items (e.g. tags) contained in equally named stringlist attributes part of one or more object classes. Note that the attributes searched for auto-completion are taken from the published content, not from the current working copy. Also, only stringlist attributes that were declared for object classes representing CMS objects are considered, meaning that auto-completion does not take account of string lists contained in widgets.

Copying images or other binaries via the JS API

Using the JavaScript API and jQuery's save and content methods, it is now possible to copy the values of binary attributes. This is useful, for example, when creating CMS objects that should be provided with a default image. As an example, the following code copies the value of the binary attribute whose DOM-ID is source_binary_field to the binary attribute named target_binary_field:

var binary_content = $("source_binary_field").scrivito("content");
$("#target_binary_field").scrivito("save", binary_content);

For further details as well as examples, please refer to the documentation we provided.

Utilizing fragment caching

The Scrivito SDK now includes a helper, scrivito_cache, for utilizing Rails' fragment caching in your application. Fragment caching applies to computed parts of views and helps to improve performance.

The scrivito_cache method expands built-in fragment caching by automatic recomputation of the cached parts of a view when Scrivito content changes. The fragments are only cached for the published content. In editable working copies no caching takes place, and the fragments are computed for every request. A usage example:

<% scrivito_cache 'navigation' do %>
  <%= expensive_navigation_computation %>
<% end %>

Additionally, the new Scrivito::Workspace#cache_key method lets you build your own caching solution. For details, please refer to the documentation.

If you are not familiar with caching yet, take a look at the excellent Rails guide on this topic.

Further improvements

If you haven't provided a filter configuration for the Content Browser, a default filter set becomes effective now.

The default filter set lets editors find either all CMS objects, images, or downloads (binaries with the exception of images). Also, CMS objects that are new or have been edited in the working copy can be found easily.

There is a new method, Obj#sorted_toclist, which returns the non-binary children of a given CMS object, similar to Obj#toclist. However, this methods sorts the CMS objects based on the child_order attribute, which is also used for sorting built-in navigations. See Making Navigations Sortable for details on how to utilize the child_order attribute.

The scrivito_tag helper now includes a simple default representation of attributes of the stringlist, enum, multienum, link, linklist, reference and referencelist types, so you do not need to provide your own rendering helpers for them as described in the SDK 0.90.0 Release Notes.


The changelog reflects minor improvements and bugfixes that were made in addition to the changes listed above.


Minor improvements

  • You can now clear searches in the Content Browser using a button we placed next to the search input field.
  • We've improved the way technical errors are reported in the UI, so that the editor is able to provide the time of occurrence and the error details to the technician.
  • After a file has been dropped onto a drop zone, Scrivito now immediately displays an upload progress indicator.
  • There are two new JavaScript API methods, scrivito.path_for_id and scrivito.id_from_path, which come in handy when extending in-place editing functionality, e.g. when letting editors create CMS objects via the JavaScript API.
  • The editor for attributes of the enum type now supports data-scrivito-editors-reload=true. This feature was requested to support details views that compute the value to display.
  • Trying to create a CMS object based on a nonexistent class using the Content Browser or scrivito.create_obj now causes a comprehensible error message to be displayed.
  • In the page and widget selection dialogs, the number of items in the “Often used” section is now limited to five.
  • The direction in which the results of a search should be sorted can now be specified alongside the field. For example, to have all CMS objects sorted from the most recently updated one down to the one that has not been touched the longest, use:
    Obj.all.order(_last_changed: :desc)
    Or, with JavaScript, fetch the most recently updated images:
    scrivito.obj_where('_obj_class', 'equals', 'Image').order({_last_changed: 'desc'})
    The reverse_order method is now deprecated and will be removed with the release of Scrivito 2.0.


  • Scrivito now actively checks whether the options given in an attribute declaration contain correct keys. It also checks whether the values provided for enum and multienum attributes are strings.
  • We fixed a problem that prevented the enter and escape hotkeys for canceling and confirming various dialogs from working as expected.
  • Editing a string in conjunction with data-scrivito-editors-reload=true no longer leads to outdated content being displayed after reloading.
  • With Firefox, the position of the caret within empty string fields sometimes had an unexpected offset.
  • We fixed a bug which, in editing mode, caused an unnecessary search request to be issued for referenced images.
  • Using a date in an invalid format in the JavaScript API now results in an error on the client side only. Previously, an exception was raised on the server.
  • We fixed the bug that caused the context menu of empty widget lists to be broken sometimes.
  • The working copy menu in the Scrivito UI is now aware of permissions and disables the items the editor is not allowed to select.
  • The buttons for editing an image and clearing a binary field no longer become unresponsive after drag and drop operations.