Skip to content

Template model

The campaign template model defines attribute names and functions which can be used inside a template. The main elements are blocks and product positions in blocks.

The campaign template model and the product template model are similar and have the same sets of lambda expressions, and work the same way with conditional content and collections. The campaign template works with campaign parameters in a similar way as the product template model works with product parameters.

Campaign name

The name of the campaign.



Campaign description

The optional campaign description.




Print description if not empty
{{#campaignDescription}} <h2>{{.}}</h2>{{/campaignDescription}}

Campaign blocks

The blocks collection is a top-level collection with campaign blocks. Each block has set of product positions, a type, and a template name.



{{#blocks}} ... {{/blocks}}


Iterate over all blocks
    <div class="block">
        <!-- Print the code associated with the block type -->
        <!-- Should be set before for each possible type -->
            <div class="product">
                <a href="{{productLink}}">
                <img src="{{productImageDesktop}}"/></a>
Select second block by index
    <div class="second_block">


Each block has its own type which can be associated with a code block to enable customization.


TOP_SELLERS - Recommends products according to their strategy score.

CUSTOMER_BASED - Recommends products based on the visitor's interest.

PRODUCT_BASED - Recommends products based on specified product sets.

FAVORITE_BASED - Recommends products based on products that a visitor have marked as a favorite.

Map block title to the template type example
{{#store.put.CUSTOMER_BASED}}<div class='customer_based'>Special for you</div>{{/store.put.CUSTOMER_BASED}}

Map several values to one block type example
{{#store.byName}}CUSTOMER_BASED : Special for you{{/store.byName}}
{{#store.byName}}blockStyle.CUSTOMER_BASED : main-recommendations{{/store.byName}}
{{#store.byName}}TOP_SELLERS : Popular with our customers{{/store.byName}}
{{#store.byName}}blockStyle.TOP_SELLERS : side-recommendations{{/store.byName}}

<div class="{{#store.byName}}blockStyle.{{type}}{{/store.byName}}">
    <div class='block-title'>{{#store.byName}}{{type}}{{/store.byName}}</div>

Template name

If the campaign block has an associated template, the name of the template can be obtained.


{{templateName}} - Obtain the template name.

{{#templateName}} ... {{/templateName}} - Enter the block section if the template name is present.

Template description

If the campaign block has an associated template, the description of the template can be obtained.



Block position

The block position in the campaign starting from 1.



Product positions

A collection of product positions. This allows for getting product images and product page URLs.


{{#positions}} ... {{/positions}}


Generate product positions with mobile images
    <div class="product-position">
        <a href="{{productLink}}"><img src="{{productImageMobile}}"/></a>
Table layout with a fixed number of columns
    <td class="product-position">
        <a href="{{productLink}}"><img src="{{productImage}}"/></a>

Product position

The position of a product in a block starting from 1.


Absolute product position

The absolute position of a product in the campaign starting from 1. {{-index}} shows the position inside collection, but {{absolutePosition}} shows the campaign block number.


A field with a link to the associated product page. For more information, see the Product URL template.


Product image

Links to images made by the associated product image template.


{{productImage}} - The URL to the image for the selected template type, defaults to Desktop.

{{productImageDesktop}} - The URL to the desktop image.

{{productImageMobile}} - The URL to the mobile image.

Mobile and desktop product images

There are two types of product templates: Desktop and Mobile. Each type can produce a different image for the same product. It can be checked if a campaign block has a template with the specific type or not. Each product position have three properties for image links: productImage, productImageDesktop, and productImageMobile.

The productImage produces a link to the selected template type. By default, it is Desktop. A mobile template will be selected inside a mobile section or inside a withMobile filter section.

Mobile section

Code inside this section will produce mobile template links by default. If the template has no mobile template, the mobile link will lead to the desktop product image.

Wrap into mobile section example
{{#mobile}} ... {{productImage}} ... {{/mobile}}

Template filters

Template filters allows for selecting only blocks which have or have not a specific template type. If the not most recent campaign version is to be re-sent, there is a possibility that not all blocks have a product image template. As product images cannot be produced for blocks without a template, these blocks can be excluded.


{{#withMobile}} ... {{/withMobile}} - Selects blocks with a mobile template.

{{#withDesktop}} ... {{/withDesktop}} - Selects blocks with a desktop template.


Select only blocks without a mobile template
{{^withMobile}} {{#blocks}}...{{/blocks}} {{/withMobile}}
Select blocks with a desktop template
{{#withDesktop}} ... {{/withDesktop}}

Template checks

As with filters, checks can be made to find out if a template type is present. This allows merchandisers to decide what should be shown if a certain template type present or not.


{{#hasMobile}}...{{/hasMobile}} - Checks if the block has a mobile template.

{{#hasDesktop}}...{{/hasDesktop}} - Checks if the block has a desktop template.

{{#hasTemplate}}...{{/hasTemplate}} - Checks if the block has any templates at all. For archived campaigns, there is a possibility that there are blocks without any templates.


This online publication is intellectual property of Voyado Lund AB. Its contents can be duplicated in part or whole, provided that a copyright label is visibly located on each copy and the copy is used in conjunction with the product described within this document.

All information found in these documents has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither Voyado Lund AB nor the authors shall be held liable for possible errors or the consequences thereof.

Software and hardware descriptions cited in these documents might be registered trademarks. All trade names are subject to copyright restrictions and may be registered trademarks. Voyado Lund AB essentially adheres to the manufacturer’s spelling. Names of products and trademarks appearing in this document, with or without specific notation, are likewise subject to trademark and trade protection laws and may thus fall under copyright restrictions.