In one of our project I faced a requirement to give multiple Datasource location to single Rendering, so that they can select whatever datasource they need. After doing some research I found that it is possible to give multiple datasource. For this first of all Login to your Sitecore.
Let’s say you have a #Sitecore structure like this -
Now we need to set 2 Datasource Locations for single Rendering. For this follow the below steps-
1) Go to particular rendering where you want to set datasource
2) Let’s say go to
3) Click on “Your Rendering”
4) Then in right hand side go to “Editor Options”
5) Firstly, go to “Datasource Template” field.
Click on “Insert Link”, a pop up will open, in which you need to select “Datasource Folder Template”
6) In “Editor Options” go to “Datasource Location” field
7) Then in the “Datasource Location” write this query –
. /_Resource|query:./ancestor-or-self::*[@@templatename=Site Node Template Name'] /*[@@templatename='Globals Folder Template Name']/*[@@templatename=Datasource Template']
What does this query means –
1) This query is divided by pipe sign (|)
2) In which “_Resource” is the first datasource location (Left part of pipe sign (|)), that is let’s say we want to give datasource to “Home” item’s rendering. So first you can see there is “_Resource” folder directly under “Home” item, so it is the path of that “_Resource” folder
3) Now we have 2nd datasource location (Right part of pipe sign (|)), that is a query. In this query you need to set “Template Names”. Let’s say you want to set 2nd location to “Datasource Folder” that is under “Globals” Folder. So all you need to do is to set “Template Name” starting from your “Site Node” to that “Globals Folder Template”, don’t include datasource folder template in this. If your datasource is under any other node under Globals folder, then need to set template names just above your datasource folder.
For ex – Your sitecore tree is like – sitecore/content/sitenode/globals/datasource folder, so set template names starting from sitenode template to globals folder.
4) Here it is all. Now go to “Home” item.
5) Click on “Presentation” tab.
6) In that click on “Details”.
7) A pop up will open in which click on “Your Rendering”
8) Then in the “General” tab, go to “Data Source” field and click on “Browse”, now you can see there are 2 datasource location, in which you can select datasource from either Globals Folder’s Datasource or _Resource Folder’s Datasource.