Sitecore SXA Custom Layout

Background :

To have more flexibility to manage assets loading on the page for SEO/web performances needs like defer/async javascripts loading or to have possibility to add form in a popup on all pages, etc…. we need to create a custom layout on Sitecore SXA (Sitecore Experience¬†Accelerator).

How to implement that ?

Solution side :
  • First step, we need an asset link generator to generate all assets links for the SXA theme of the current site. In this example of code, you can see defer javascripts loading parameter on line 53.
  • Next step, we need a view for our custom layout :

Sitecore side :

  • we need to create layout item under layouts tree.
  • Finally, we can use the new custom layout on website pages :

That's it, Enjoy :)

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *