Sitecore SXA

SXA 9.3.0 with Scriban

Dominic Sinclair-Moore
Scriban here, Scriban there, Scriban everywhere?

Overview

With the introduction of Scriban in SXA 9.3.0, the flexibility given to front-end developers is better than ever. You may not be at the point to implement JavaScript Services for Sitecore (JSS) but with Scriban you're giving back some of the control. Out of the box, SXA provides us with embedded items (eg. i_home or i_item) and context objects (eg. o_model or o_context) as well as many additional functions and item/field extensions too. Sitecore has plenty of documentation on Scriban. That is all well and good, but why the change to Scriban in the first place? In short, the SXA development team needed an alternative to NVelocity to improve the feature set and flexibility within SXA . After a period of research and development, Scriban was chosen for it's uncompromising performance and flexibility in comparison to many other templating engines.

The out of the box Scriban extensions created by Sitecore will satisfy most developers needs with the ability to pipe through functions and query the full Sitecore tree without adding any additional code behind. If you find yourself in the situation that doesn't seem possible in Scriban or at least very complex, you may want to create an item extension to simplify the process and enable the functionality for all items, for example. You may also want to create a function with one purpose, for example fetching the URL within a link field.

"One does not simply migrate to Scriban"

If neither of these methods seem viable to you, most likely you are migrating from NVelocity than developing something new within Scriban. In this case I would still strongly recommend trying the previous two methods to simplify the code base and enabling front-end developers to be able to take more control of rendering the data which is very similar in JavaScript Services for Sitecore (JSS). I would recommend keeping the above quote in mind when "migrating" as you'll find Scriban is more powerful than you initially thought. If this is still not possible then check out our post on how to migrate NVelocity Extensions to Scriban.

Cookie Policy© 2021 — DOTNET Ltd