Creating custom DXA module(s)

Welcome to another post of the Digital Experience Accelerator (DXA) marathon, meant to explain how DXA works, what are the different ways to use it and how can you contribute to it.

Yesterday’s post talked about how to set-up the development environment in .NET and create the first DXA project with the site as a module.

Today we will continue with creating modules in order to have a more flexible, reusable, cleaner and more transparent work environment.  The breakdown of the development into distinct modules is applicable to anything, from a large functionality like a backend integration (PIM,CRM, DAM), authentication through social media or the development of custom controllers.

If you choose to develop your website in an agile way, it is expected to have shippable products at the end of each sprint.  Having the right breakdown of the development into modules becomes critical for easier and faster release of the functionalities.

To start, first open the DXA solution we worked on yesterday and add a new project. If you have not read yesterday’s blog, check the DXA Visual Studio Extensions mentioned in it. When adding a project, select the option “DXA Module Project”. This contains a package file, default MVC references and a build event that you can enable similarly to the Site project.

When your custom module involves extending DXA, you can add the following references;

  • Sdl.Web.Common
  • Sdl.Web.Mvc
  • Sdl.Web.Tridion

These and the reference of DD4T can be found in the downloaded zip file of DXA, underneath Web > bin.

Now that you are developing the modules, an important step is to create the right dependencies between the projects and the default site (or custom site). This can be done by right clicking on the Site Solution and select Properties. A pop-up window will appear, select Common Properties > Project Dependencies and choose the projects and their dependencies.

Want to share you module with the community, and help or inspire others to build modules. Upload your module on https://community.sdl.com/developers/tridion_developer/m/mediagallery.

Or if you like the Visual Studio Extension and you want to contribute to it; the source can be found here https://github.com/jarnohenneman/dxa-visual-studio-templates

Thank you, and hope to see you tomorrow for another DXA post  Embarrassed