Efficiently Caching : Localised XF with SDI for MSM | AEM Community Blog Seeding

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

6.0K

Likes

1.1K

Correct Reply

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

6.0K

Likes

1.1K

Correct Reply

1.1K
kautuk_sahni
Community Manager

21-03-2021

BlogImage.jpg

Efficiently Caching : Localised XF with SDI for MSM by AEM Concepts

Abstract

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

Read Full Blog

Efficiently Caching : Localised XF with SDI for MSM

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager