Search This Blog

Sunday 14 March 2021

Efficiently Caching : Localised XF with SDI for MSM

Even though we improved caching by introducing SDI in previous article, but SDI with XF don’t work in case of multilingual sites.

OOTB experience fragment(w/o SDI) works by rendering the localised XF on the fly for multilingual sites. However the XF component doesn’t have any provision for SDI. The ootb code is not able to pick up localised XF’s if we render XF’s using SDI.

Why Localised XF don’t work with SDI on the dispatcher?

If we use SDI the currentPage object points to template page(ie /conf) though the OOTB XF code expects current page to be pointing to the content page(ie /content) and not the template page and hence the code breaks in case of SDI XF for MSM and it is not able to deliver localized XF’s on the dispatcher.

Hence we need to tweak the OOTB XF component if we want to be able to extend it for SDI’s. Follow the steps below to extend the OOTB XF component for SDI’s. 

1)  Add suffix=current page

     Add rewrite rule to append suffic to the sdi call on page



# RewriteRule ^(.*)$ $1%{ENV:DOCUMENT_URI} [PT,QSD]
RewriteCond %{REQUEST_URI} .xf.html$
RewriteCond %{REQUEST_URI} ^/(content|conf)
RewriteRule ^(.*)$ $1%{ENV:DOCUMENT_URI} [PT]
	


2) Modify the OOTB XF code to read the current page from suffix.
    com.demo.web.core.models.impl.ExperienceFragmentImpl















3) All Sling models used for components on header/footer XF would also need to be    modified similarly  to read current page from suffix.


No comments:

Post a Comment