How to resolve issues with ampersand in title for inline templates

To resolve, please do the following:

  1. Open the Workbench > System Design > expand Configurations > Open User Velocity Macros (rx_Assembly.vm)
  2. Add the following code to the bottom of the file:

#macro(fieldEsc $fieldname)##
#startAAField($fieldname “”)##
#if ($sys.part.render)##
$rx.codec.escapeForXml($sys.item.getProperty($fieldname).String)##
#end#endAAField($fieldname)##
#end##

#macro(fieldLinkEsc $fieldname $pagelink)## #startAAField($fieldname
$pagelink)## #if ($sys.part.render)##
$rx.codec.escapeForXml($sys.item.getProperty($fieldname).String)##
#end##
#endAAField($fieldname)##
#end##

#macro(displayfieldEsc $fieldname)##
$rx.codec.escapeForXml($sys.item.getProperty($fieldname).String)##
#end##

#macro(field_if_set_esc $before $field $after)##
#if($sys.item.hasProperty($field))##
$before##
#fieldEsc($field)##
$after##
#else##
#__handlefieldaa($field)##
#end##
#end

##the following macros are for the apostrophe in the Title##

#macro(displayfieldAposEsc $fieldname)##
#startAAField($fieldname “”)##
#if ($sys.part.render)##
$rx.codec.escapeForXml($sys.item.getProperty($fieldname).String).replaceAll("’","’")##
#end#endAAField($fieldname)##
#end##

#macro(fieldAposEsc $fieldname)##
#startAAField($fieldname “”)##
#if ($sys.part.render)##
$rx.codec.escapeForXml($sys.item.getProperty($fieldname).String).replaceAll("’","’")##
#end#endAAField($fieldname)##
#end##

  1. Save the macro file,
  2. Open Assembly Design > expand Templates
  3. Modify your snippet templates so that they use the new escape macros.

Note: you cannot use the escape macros on any field that is a rich text field (Ephox). On an out of the box system, that means you can’t use the escaped macros on callout and body fields.