loading table of contents...

Content Application Developer Manual / Version 2310

Table Of Contents Metadata Support in JSP Templates



Support for JavaServer Pages (JSPs) is deprecated and will be removed in future releases.

If you want to add metadata to an HTML document from within a JSP template, include the JSP tag cm:previewScripts in a template that is called once for each HTML page. You can then use the tag cm:metadata each time metadata is to be assigned to an HTML DOM node.

The tag cm:metadata checks whether metadata rendering is enabled (either globally or locally for this tag occurrence). If enabled, the given metadata is serialized as a JSON string. In the rendered content item, this string is escaped accordingly and output as the value of the custom HTML attribute data-cm-metadata of the HTML element that the metadata is attached to.


<cm:metadata value="${self.content}" />

To allow assigning multiple metadata nodes to the same DOM node, multiple nested cm:object tags have to be used instead of the value attribute. cm:object has only a value attribute and is used for list elements.

  <cm:object value="${self.content}"/>
  <cm:object value="properties.title"/>

Example 4.13. Content With Property

The tag cm:property can be nested into cm:metadata, cm:object or cm:property to create a name-value pair. Again, the value can be specified either as an attribute or through nested tags.

  <cm:property name="cm_preferredWidth" value="1280"/>
  <cm:property name="cm_responsiveDevices">
    <cm:property name="mobile_portrait">
      <cm:property name="width" value="320"/>
      <cm:property name="height" value="480"/>
      <cm:property name="isDefault" value="${true}"/>
      <cm:property name="order" value="1"/>

Example 4.14. Responsive Device Slider Metadata

Search Results

Table Of Contents

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.