Custom Tags & Modules

How ismodule custom tags are discovered, completed, and linked to their templates, and how to choose which files declare them

SFCC lets you define reusable custom tags with <ismodule>. The ISML server indexes these declarations, so your custom tags complete with their attributes and link to the template they render, like the built-in tags

Once modules.isml declares the tag, isproducttile joins the tag list and completes the attributes its <ismodule> lists, skipping the ones already on the tag

Declaring a custom tag

An <ismodule> declaration maps a tag name to a template and lists the attributes the tag accepts:

util/modules.isml
<ismodule template="components/productTile"
    name="producttile"
    attribute="product"
    attribute="class"
/>

This declares <isproducttile>. Its product and class attributes reach components/productTile.isml as pdict.product and pdict.class. At runtime, a template includes the module file before it uses the tag:

search/productGrid.isml
<isinclude template="util/modules" />
<isproducttile product="${pdict.product}" class="grid-tile" />

Write the name, template, and attribute values in double quotes, because the server reads only double-quoted values. A declaration can span several lines

Discovery

The server scans every cartridge for module files and records each declaration's name, template, and attribute list. By default, module files are the templates named modules.isml or module.isml. Adding, editing, or deleting a module file updates the tags without a restart, and the tags are available in every template

Change which file names count as module files with intellij-sfcc.isml.modules.files. The list replaces the default, so keep the default names you still use:

settings.json
{
  "intellij-sfcc.isml.modules.files": ["modules.isml", "module.isml", "brandmodules.isml"]
}

A changed list applies at once: the server reads the listed module files again, with no reload. See Linter and custom tags

What you get

  • Tag completion - is plus the declared name, such as isproducttile, appears in the tag list
  • Attribute completion - inside the tag, the declared attributes complete, skipping the ones already on the tag
  • Link to the template - the tag name is a link to the module's template, see below
  • Tag color - the tag takes the ISML tag color, like the built-in tags

Custom tags have no hover documentation, and their attributes are not validated

Open a custom tag's template

A custom tag declared with <ismodule> is a link to its template: Cmd-click the tag name (Ctrl-click on Windows and Linux) to open it

Cmd-click a custom tag name (Ctrl-click on Windows and Linux) to open the template named in its <ismodule>. When that template exists in more than one cartridge, the Select ISML File quick pick asks which copy to open, as it does for template paths. A tag gets a link only when its module template exists in an indexed cartridge

On this page