Scaffolding in Sitecore lets you add modules/components to tenants and sites. OOTB SXA modules are stored in Feature or Foundation folder:
- /sitecore/system/Settings/Feature/Experience Accelerator
- /sitecore/system/Settings/Foundation/Experience Accelerator
In addition to that we can create our own custom SXA components/modules which can be installed just like regular SXA modules.
The SXA components we build could have some site items which we want to install to specific location(s) when this component gets installed like specific data/settings/dictionary/under home etc… This is where SXA scaffolding comes into picture- it enables module-items to install into custom location(s) based on the component requirements so that content authors doesn’t have to install it manually and we give them a seamless module installation experience.
Scaffolding can be configured on tenant or site level, you can see scaffolding options when you create a module, below screen shot for ref.
We have OOTB options to create items to some default location(s) like:
- Under home item
- Under Data
- Some standard items under Presentation and Settings.
For e.g. we can create item of type “AddItem” and specify the location and template, to define where and what type of item we want to create, this helps in installing item(s) in some standard location(s) supported by SXA.
How about if we want to install some item(s) into such location(s) which doesn’t support OOTB by scaffolding action items?
Problem statement : We want to create dictionary items under Site-> Site Dictionary->[Component Dictionary Item] while installing a new module to specific site.
So, how we go there? – we can leverage ExecuteScript action item and write script to create item(s) in any specific location, here are the steps to follow:
- Navigate to your site setup item.
- Right click on site setup item and create an item say [AddDictionary] based on “ExecuteScript” template.
- The script which we are going to create will be referred in the field called “Script” under section “Script“
- Navigate to /sitecore/system/Modules/PowerShell/Script Library and Create an item say. [TestModule] of type “PowerShell Script Module” template.
- Right click on [TestModule] item and create an item say [Functions] based on “PowerShell Script Library” template
- Right click on [Functions] and create following scripts:
This script is used to create dictionary item under site->site dictionary domain> for selected site.
This script returns the dictionary domain item based on selected site node and called from Add-SXAModuleDictionary script.
This script filters the dictionary domain item based on items from selected site node and called from Get-DictionaryDomain script.
Once you have all the scripts created, navigate back to your site setup scaffolding and click on [AddDictionary] item which you created above in step#2 and set[ Add-SXAModuleDictionary ] script to the Script field.
Next- try to install the module using script->Add site module and select your related module and after the script execution is over you can go back to your Site-> Site dictionary domain-> and you should see [TestModuleDictionary] item created there.
This way you can perform any kind of operation while you are installing specific module to a site, this was just an example to show how you can leverage this feature to provide a seamless module installation experience to your authors.
Hope it helps!
Happy learning 🙂