I have a situation where I have a Component Link which contains fields that I'd like to be editable within Experience Manager. Component A contains a link to component B, which has a link to multimedia component C.

Component B has some fields related-ish to Component C. I would like to render C, allow the content author to edit fields in B, and also in A.

Component B has no template. Component A is the only template.

I understand that DXA does not add XpmMetadata to linked components on its own. But I can generate XpmMetadata for this.

So I'm trying to create a helper that does this for me. XpmMetadata Contains five properties:

  • ComponentTemplateID
  • ComponentModified
  • ComponentID
  • ComponentTemplateModified
  • IsRepositoryPublished

If I want fields within a linked component to be editable, I'm guessing that ComponentID is for the linked Component. And I would guess that ComponentModified is, too.

I can get the ComponentID, but how do I get the ComponentModified property? OR, can I use the ComponentModified property from "Component A".

I've developed a solution that I think would work, but I'm not 100% sure because I don't know the rules around these fields

Below is the class I'ved added to a helper:

   public static class DXAComponentLinkHelper
       public static IDictionary<string,object> getXpmMetadata(EntityModel entity, Dictionary<string, object> parentXpmData)
            Dictionary<string, object> xpmMedatadata = new Dictionary<string, object>();

        object parentTemplate = null;
        object parentCompModified = null;
        parentXpmData.TryGetValue("ComponentTemplateID", out parentTemplate);
        parentXpmData.TryGetValue("ComponentModified", out parentCompModified);

        xpmMedatadata.Add("ComponentID", entity.Id);
        xpmMedatadata.Add("ComponentModified", parentCompModified);
        xpmMedatadata.Add("ComponentTemplateID", parentTemplate);
        xpmMedatadata.Add("ComponentTemplateModified", parentCompModified);

        xpmMedatadata.Add("IsRepositoryPublished", false);

        return xpmMedatadata;


Is this a viable solution? is there a better one? How can I XPM-enable inline editing on a linked component without creating a component template?

  • How is this not a duplicate of tridion.stackexchange.com/questions/18744/… exactly? Apr 25, 2018 at 7:17
  • my question is specifically about how xpmMetadata should be constructed. the solution I whipped up more or less "fakes" the xpmMetadata. I steal a few values from the parent component. I don't know if this is a viable option, though.
    – paceaux
    Apr 25, 2018 at 7:20
  • It's also worth noting that "Component B" does not have a template. We aren't linking to Component B for purpose of generating a link, but rendering content from Component B.
    – paceaux
    Apr 25, 2018 at 7:29
  • The reason for your solution is clear to me, I see the differences with the mentioned question now, I'll see if I can answer your questions Apr 25, 2018 at 7:36

2 Answers 2


Let me start with making one thing clear (I gather you know it already, but just for the sake of others coming across this question), what we are doing here is a hack to make linked Components editable in XPM (since XPM currently only supports editing Component presentations, and you are missing a Component Template).

Now on to your questions:

With XPM you have to be very careful when faking data or using dummy data, since it always has to reflect actual data of the CMS. So when faking a Component Template, make sure you use an existing Component Template URI, from the correct context Publication and with the right modification date. The same counts for the modification date of your Component. If you use an incorrect date, XPM will notify you that your page is out of date and you need to refresh it (and it will keep complaining about that).

See Inline editing of linked Components via a custom model builder in DXA for a possible solution on how to get the correct information of the Component, and merge that with using the "parent" Component Template information and you should have a working solution.

  • " If you use an incorrect date, XPM will notify you that your page is out of date and you need to refresh it (and it will keep complaining about that)." I didn't know that, but that is an excellent insight, thank you
    – paceaux
    Apr 25, 2018 at 15:31

Let me elaborate Bart's statement that "this is a hack to maked linked Components editable in XPM"... Note that XPM currently doesn't fully support editable linked Components.

This is visible from the fact that there is no XPM markup for a Component and thus you will have to fake a Component Presentation in XPM markup.

But there is more: XPM allows the user to change Component Template and reorder Component Presentations on a Page. Obviously, that doesn't make sense for these fake Component Presentations.

Last but not least, XPM may get confused by these fake Component Presentations which are not really on the Page in CM. There is a mechanism for such dynamically queried Component Presentations, though: set IsQueryBased to true in the XPM markup of the Component Presentation.

  • 1
    Good to point out the IsQueryBased attribute, I think that will also disable the ability to move the Component Presentation on the page, which else would indeed be another unwanted side effect. Apr 26, 2018 at 9:12

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.