All template tags can and should be used within a conditional block. The conditional block checks to see if there is a value associated with the specified tag, and conditionally displays or doesn’t display the content within the block.

?{{Title}}
   <p class="article_title">${{Title}}</p>
?{{/Title}}

Alternatively, a conditional statement can check for a negative condition, using the following syntax.

!{{Subtitle}}
   <p>This article has no subtitle.</p>
!{{/Subtitle}}

You can also put non-primary template tags inside of a block, as you can see in the example below.

?{{Title}}
   <p class="article_title">${{Title}}</p>
   <p class="article_subtitle">${{Subtitle}}</p>
?{{/Title}}

The visibility of any additional template tags inside of a conditional will be determined by whether the primary tag has a value. For instance, in the example above, the Subtitle will not be shown if there is no value in the Title field. You are free to put any markup or content you like inside of a conditional block.

Nested Conditional Blocks

Conditional blocks can be nested. For example:

?{{Title}}
   <p class="article_title">${{Title}}</p>
   ?{{Subtitle}}
      <p class="article_subtitle">${{Subtitle}}</p>
   ?{{/Subtitle}}
?{{/Title}}

This example block first checks if a Title exists and displays it, then checks to see if a Subtitle exists and displays it, however if a Title is not present, the Subtitle will not show either, even if it has a value.

Multiple Value Conditional Blocks & Special Cases

The ?{{Ad}} conditional block has multiple values that all need to be present for the block to be shown. It must contain the following tags or will not display.

  • ${{AdUrl}}
  • ${{AdImgSrc}}
  • ${{AdAlt}}

Example markup:

?{{Ad}}
   <div class="ad_block">
      <a href="${{AdUrl}}"><img alt="${{AdAlt}}" src="${{AdImgSrc}}" /></a>
   </div>
?{{/Ad}}

This can be helpful to ensure advertisements are not displayed in an article that does not have all of the necessary components. It is not required to use the ?{{Ad}} conditional to use the inner components – they can be used independently.