When Salesforce Commerce Cloud generates web pages on the application server, it uses ISML Templates and scripts within the Controllers. B2C Commerce Script API in the Controllers access the database layer if necessary. We are going to describe the best practices for:
You should keep ISML as clean as possible. It’s always good for performance tuning and maintainability of your site.
You can write Salesforce Commerce Cloud scripts inside ISML templates using <isscript> tag. In general though, you should use scripts in your controllers and passing the information via viewData rather than using <isscript> blocks and be sure to keep them small. To ensure that you can diagnose performance issues, break large <isscript> blocks in the templates into multiple pieces. With smaller scripts, you’ll be able to pinpoint bottlenecks more efficiently. Smaller scripts also help with readability.
Local includes are useful when you want to reuse partial templates. They are simply merged with the including template as an ISML file before it is compiled.
Pipeline dictionary variables (pdict) can be used in the included templates as well. You don’t haveto initialize and fetch data if the variables are already available in the pipeline.
<isinclude template=”/components/your-template.isml” />
For each remote include in a page, a placeholder is inserted and a page is delivered from the application server to the web server. The web server parses the page and calls for every include placeholder the application server again (as long as this is not cached already). This could cause “Ping-Pong” between the two servers. Use care with remote includes:
<isinclude url=”${URLUtils.https(‘Home-Show’)}” />
👉 MORE ABOUT COMMERCE CLOUD
Unlock a FREE PDF with SFCC B2C Certification questions from our Udemy Course. Join our newsletter!
Check your email, you’ll receive a copy in a few seconds. If you don’t see it, please check your spam folder.
Do you like cookies? 🍪 We use cookies to ensure you get the best experience on our website. Learn more.