A colleague pointed out the XPM documentation suggests outputting an empty TCDL tag allows authors the ability to edit fields which are not rendered.


<!-- TemplateBeginIf cond="CollectionLength('Field.Values') == 0" -->
 <tcdl:ComponentField name="${Field.Name}"></tcdl:ComponentField>
<!-- TemplateEndIf -->



What's the equivalent XPM inline editing comment syntax for these?

I'm posting an example below for reference. We've seen questions on making empty fields editable (https://stackoverflow.com/q/12050672/395495), but I wasn't sure of the JSON comment syntax.

1 Answer 1


For this source (note summary field is missing):

<Content xmlns="http://Electridion.com/Schema/Article" xmlns:xlink="http://www.w3.org/1999/xlink">
    <title>Electridion Events</title>

In 2013, I used:


Source on Staging:

  <!-- Start Component Field: {"XPath":"tcm:Content/custom:Content/custom:summary[1]"} -->

TCDL equivalent in Template Builder:

<tcdl:Field xPath="tcm:Content/custom:Content/custom:summary" itemId="tcm:69-6362-v0">
  <span><!-- Start Component Field: {"XPath":"tcm:Content/custom:Content/custom:summary[1]"} --><tcdl:FieldValue index="0">

So it seems the XPath is as it would be if there was a value in the field. All this needs is a check to only output the empty markup if the field is actually empty.

  • "All this needs is a check to only output the empty markup if the field is actually empty." When the field is not empty your template would output the same markup I guess. When we have a template that hides a HTML section (i.e. an H1 which takes space even when it is empty), then we want to render that section with the empty markup but only in staging. Or only when the component is in edit mode in XPM.
    – Jan H
    Commented Sep 5, 2014 at 7:12
  • I wonder is there any clever trick for DD4T (and the likes) that would allow forging SE markup for unassigned (and effectively non-existing) fields?
    – esteewhy
    Commented Oct 2, 2014 at 11:08
  • When DD4T serializes the Component XML, what happens for empty fields? If it "knows" about them, I think this would be an interesting, useful exercise (worth trying on the Tridion Reference Implementation). :-) Commented Oct 8, 2014 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.