You can find lot of modules shipped together with Sitecore Experience Accelerator (SXA).
This blog post will guide you through process of creating your own custom modules to SXA.
SXA itself follows Helix principles and it’s also great example how these principles can be applied in “real” solutions/ projects.
1. Foundation or Feature module?
First question that you need to answer is whether your new custom module will be Foundation or Feature module. Following Helix documentation article can help you with the decision -> https://helix.sitecore.net/principles/architecture-principles/layers.html.
Based on the decision, just follow below instructions in either Foundation or Feature paths a.k.a. just substitute Feature with Foundation when you are creating Foundation module as examples are for Feature module.
2. Create module grouping
It’s always a good practice to group your modules by your customer/client name, or branch or brand name, or basically anything based on your solution structure, needs or naming conventions. I have used “Client Name” as example below.
Similarly the SXA modules are grouped under /sitecore/system/Settings/Feature/Experience Accelerator
If it’s your first module in this group, create group. If you have already created group, just skip this step.
To create module group, navigate to /sitecore/system/Settings/Feature item, right click on it and insert Folder item:
I have named it “Client Name” as example:
3. Create module – finally! 🙂
Now it’s finally time to create module.
Navigate to /sitecore/system/Settings/Feature item, right click on it and insert Module item:
Wizard is opened:
You need to specify some properties:
- Name of your module
- Location of your module or path to your module group – click on arrow down on the right and select your desired module group
- In this field you need to specify areas where container folders should be created. If you choose Templates, there will be container folder created for your module in path /sitecore/templates/Feature/Client Name/Custom Client Module and similarly for all areas which you check
- In most of the cases, you can uncheck Tenant Setup as usually you are creating modules that will be added just onto Site not Tenant.
Click Proceed and you are done:
All scaffolding folders were created for you and you can start adding your component(s), templates and other functionality to the module.
SXA all the things!