Posts

Showing posts with the label Custom

Fix for the issue with renaming local data sources resulting in broken links

Image
Sitecore introduced local/page data sources with SXA. The local data sources allow better organisation of your page specific and shared data sources. However, one challenge with local data sources is, the links to them won't automatically get updated when you rename them. This is because Sitecore uses the path instead of ID to link to local data sources. If you inspect the raw value of final renderings field of a page with module that has local data source you can see the path "local:/Data/...". For this reason Sitecore warns about renaming local data sources manually. The documentation clearly says you need to convert your local data source paths to IDs using the out of the box scripts provided before renaming the local data source item. (Source: https://doc.sitecore.com/xp/en/developers/sxa/93/sitecore-experience-accelerator/data-sources.html#rename-local-data-sources) The script works fine in most cases, except for when not all your data sources are direct children of ...

SXA Scriban extension to get link field target URL

Scriban is the new templating language which was introduced in Sitecore 9.3, it replaces the obsolete NVelocity templates in the earlier versions. If you are upgrading from earlier versions of Sitecore and used a lot of NVelocity templates, you need to convert all your NVelocity templates to Scriban as NVelocity is no longer supported in Sitecore 9.3. Scriban is a powerful language with support to import your own .Net functions. Sitecore provides a rich set of Scriban extensions to use which meets most of the common requirements. You can find more about the out of the box Sitecore Scriban extensions here . While using Scriban to create custom markup which can't be achieved through other Rendering Variant fields I came across a requirement to wrap a section of HTML with an anchor tag targeting to an URL set in a link field in the template. In SXA we would set the link target field on the Rendering Variant and set the Is Link property value of the Rendering Variant field to W...