SDI ESI vs ESI tags | Community
Skip to main content
June 9, 2022
Solved

SDI ESI vs ESI tags

  • June 9, 2022
  • 2 replies
  • 1483 views

Is there a benefit to using the Sling Dynamic Include ESI feature as opposed to just having <esi> tags on the page?

 

i am looking to pull some dynamic data into my AEM page. Trying to understand the difference between the two options:

Option1: Create a component that has the logic to call the backend API and inject into the page using AEM SDI (Sling Dynamic Include)

Option2: Include ESI tags within my component. Essentially

<esi:assign name="val">dynamic value</esi:assign>
<esi:eval src=""/> <esi:vars> val = $(val) </esi:vars>

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

@aemuser29,

When you use the SDI bundle from AEM, with proper configuration (in particular the SSI with apache config) your apache web request to the publish will return an HTML document, with target resource types being transformed to return lines of code that look like this, <!--#include virtual="/content/geometrixx/en/jcr:content/carousel.nocache.html" -->

 

Similarly, when you have enabled ESI tags enabled, your apache web request to the publish will return an HTML document, with target resource types being transformed to return lines of code that look like this, <esi:include src="/content/geometrixx/en/jcr:content/carousel.nocache.html" />

 

Not only does the Sling Dynamic Include bundle transforms the target resourceType into an include string for either SSI or ESI, but it also does some magic to allow AEM publisher to fetch the AEM resource as a single web resource. Now it's up to Apache or Edge to compute the dynamically included resourced.

 

-------------------------------

 

Without using the Sling Dynamic Include bundle, you will require to set the code manually... this is bad author experience and can be very manual. You will need to set something like this manually:

<!--#include virtual="/content/geometrixx/en/jcr:content/carousel.nocache.html" -->

or
<esi:include src="/content/geometrixx/en/jcr:content/carousel.nocache.html" />

 

...it can be time-consuming, and scalability can be a pain.

2 replies

arunpatidar
Community Advisor
Community Advisor
June 9, 2022

Hi,

Can you check this https://engineering.icf.com/esi-rendering-dynamic-content-aem/?

both uses the same concept.

Arun Patidar
BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
June 10, 2022

@aemuser29,

When you use the SDI bundle from AEM, with proper configuration (in particular the SSI with apache config) your apache web request to the publish will return an HTML document, with target resource types being transformed to return lines of code that look like this, <!--#include virtual="/content/geometrixx/en/jcr:content/carousel.nocache.html" -->

 

Similarly, when you have enabled ESI tags enabled, your apache web request to the publish will return an HTML document, with target resource types being transformed to return lines of code that look like this, <esi:include src="/content/geometrixx/en/jcr:content/carousel.nocache.html" />

 

Not only does the Sling Dynamic Include bundle transforms the target resourceType into an include string for either SSI or ESI, but it also does some magic to allow AEM publisher to fetch the AEM resource as a single web resource. Now it's up to Apache or Edge to compute the dynamically included resourced.

 

-------------------------------

 

Without using the Sling Dynamic Include bundle, you will require to set the code manually... this is bad author experience and can be very manual. You will need to set something like this manually:

<!--#include virtual="/content/geometrixx/en/jcr:content/carousel.nocache.html" -->

or
<esi:include src="/content/geometrixx/en/jcr:content/carousel.nocache.html" />

 

...it can be time-consuming, and scalability can be a pain.