isinclude syntax for template and URL includes
Key Takeaway
<isinclude template="..."/> pulls another template into the page, which is a local include. <isinclude url="..."/> inserts the output of a separate request, which is a remote include. That request can have its own caching, so use a remote include to keep part of a cached page dynamic.
The <isinclude> tag in B2C Commerce ISML pulls content from another source into a template. You can then build a page from reusable pieces instead of repeating markup. A local include inserts another template file. A remote include runs a second pipeline as its own request and inserts what that request returns. Because that request can be cached on its own terms, a remote include can keep one part of a cached page dynamic.
Two kinds of include
<isinclude> includes content from an additional source in a template. The tag comes in two forms. Each <isinclude> uses either the template attribute or the url attribute, but not both.
| Local include | Remote include | |
|---|---|---|
| Attribute | template | url |
| What it inserts | The content of another ISML template | What a second pipeline returns, reached by URL |
| How it runs | Pulled into the current template | An additional request to the Application Server |
<!-- Local include: insert another template -->
<isinclude template="components/footer/newsletterSignup"/>
<!-- Remote include: insert what a second request returns -->
<isinclude url="${URLUtils.url('Loyalty-PointsBadge')}"/>The first tag pulls in a template by name. The second tag uses URLUtils.url to build the URL of a Loyalty-PointsBadge controller action. The output of that request goes into the page.
<isinclude> is allowed anywhere in a template. As a best practice, put includes that affect the whole page at the top of the template.