Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

SDI ESI vs ESI tags

Avatar

Level 1

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>

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@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.