Customizing OOTB SXA components with Custom Views

Reading Time: 3 minutes

In my previous blog post, I have compared options for extending and altering OOTB Sitecore SXA components.

One of the options was Custom Views. It has some nice advantages but also of course some disadvantages. For certain requirements it is however perfect fit! This functionality is available as of SXA version 1.8.

Great thing about Custom Views is that they can be site or tenant specific. If you have different HTML expected per site this is really cool.

By tenant specific I mean you can use same folder with Custom Views for every single site under that tenant.

In this article I will show you how easy it is to alter generated HTML of OOTB SXA component with this method.


Setting Custom Views on Site level

1) First you need to create folder where you place site or tenant specific Custom Views – for me it was “SkCustomViews”. I have therefore created this folder under $path_to_your_instance$\Views:



2) You need to create same structure of folders under your freshly created CustomViews folder as OOTB SXA Views have for component that your are altering view. For me it was Container component therefore I have done it like this:



3) Navigate to $path_to_your_instance$\Views, copy the web.config file and paste it into the folder you just created so in my case $path_to_your_instance$\Views\SkCustomViews\Views:



4) Now it’s the time to make SXA site aware of our Custom Views.

In Content Editor navigate to tenant\site\Settings item and its “CustomRenderingViewPath” field.

Set the value as “~/Views/$your_folder_name_goes_here$” . For me it was “~/Views/SkCustomViews” as you can see below:


5) Let’s validate what we have done.

I have slightly modified my Custom View for Container so we see the difference (mind the yellow highlighted “row”):


6) Victory! Works like charm! 🙂

HTML generated by Container component before:


and after:


Omit that the generated HTML is not Bootstrap complaint 😉

As you can see you can really quickly alter OOTB SXA Views with this approach. There is also article in SXA documentation that you can follow.

Setting Custom Views on Renderings

You have of course possibility to set your Custom View directly on Rendering itself but it’s not best practice for OOTB components:


Above mentioned option is much cleaner and in terms of maintainability and upgradability perfect solution.

Happy customization!

One comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.