Sitecore DEF + SXA — Part 2: Resolving SXA local data source item

Hello friends.

This is the continuation on my series of SXA+DEF code snippets.

You can see my previous post from the series here:

Sitecore DEF + SXA — Part 1: Handling duplicate items when resolving item | by Jack Spektor | Jun, 2022 | Medium

Today we are going to talk on how to create SXA local data sources through DEF.

Today most of Sitecore websites are based either on SXA or JSS as it saves time for development effort.

Therefore migrating data from other systems should also take into account using SXA.

What if for example we want to create a new local SXA data source like this one?

We can’t simply use ResolveItem step that comes OOTB as it wouldn’t use Data folder that exists.

Here how we can solve this problem though with custom code:

Sitecore.DEF.SXA/ResolvePageDatasourceProcessor.cs at main · JackTheHack/Sitecore.DEF.SXA (

Here in this custom DEF step we are doing 3 things:

  1. We are creating new data folder if it doesn’t exist yet

2. We override the default ResolveItem pipeline logic to use the data folder as a parent item instead

Now our DEF pipeline would be able to create SXA datasources under Data folder.

P.S: In the next article I’m going to continue on SXA+DEF series and would cover on how to add new rendering to the item with custom DEF pipeline.

See ya!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store