3

I've found a possible issue for XPM in SDL Tridion 2013 SP1. I describe the problem: I have four Component Presentations on a Page, which are duplicated two by two. It means, I have this HTML structure:

<span>
 <!-- Start Component Presentation 1 (Component 1 + Component Template 1) -->
</span>
<span>
 <!-- Start Component Presentation 2 (Component 2 + Component Template 2) -->
</span>
<span>
 <!-- Start Component Presentation 3 (Component 1 + Component Template 1) -->
</span>
<span>
 <!-- Start Component Presentation 4 (Component 2 + Component Template 2) -->
</span>

When I drag a Component just above the Component Presentation 3 (Component 1 + Component Template 1) the Page renders the new Component Presentation and put it above the Component Presentation 1 (Component 1 + Component Template 1).

I understand it's a possible issue because it should puts the new Component Presentation above the Component Presentation 3, but I think the problem is the Component Presentation 1 and the Component Presentation 3 are the same and they have the same XPM markup.

  • If you open the page in "form view", is the CP placed in the correct position? If yes, then it might be a (page) template issue. Otherwise... indeed it could be XPM. – Nuno Linhares Aug 22 '17 at 8:01
  • I've opened the page in "form view" and the CP is not in the right place, so it seems that it is a XPM issue, right? – Sergio Alonso Aug 22 '17 at 8:06
  • I'm curious about the use case: why do you want to output the exact same thing multiple times on the same webpage? – Peter Kjaer Aug 22 '17 at 8:32
  • Because Tridion allows us to insert the same CP in a webpage multiple times... For example, imagine you want to insert the same image two times in a header, one in the left side and the other one in the right side. – Sergio Alonso Aug 22 '17 at 8:50
3

The problem you are encountering is that your Component Presentation (the combination of a Component and a Component Template) is not unique on the Page, and thus XPM doesn't have anything to uniquely identify/handle it with.

You will also notice that as soon as you select one of the duplicate CPs on the Page, both wil get an active border around them, since you are editing both. When it comes to drag and drop, XPM cann't perform that action, since it doesn't know which one of the CPs you are actually dragging above or below. It cannot identify the CP (the order from the Page was used to render them out, but they are not uniquely identified when XPM indexed the rendered Page). So the end result will just take the first CP found on the Page and use that as a reference.

If you look at the documentation for the Start Component Presentation XPM markup: https://docs.sdl.com/LiveContent/content/en-US/SDL%20Web-v5/GUID-33B86230-022A-46CA-9121-D518B41BE124 you indeed see that there is no unique ID to be found in there.

I seem to recall we could also write this as follows:

<!-- Start Component Presentation: {
    "ID" : "SomeUniqueID", 
    "ComponentID" : "tcm:2-635", 
    "ComponentModified" : "2013-01-22T11:25:12", 
    "ComponentTemplateID" : "tcm:2-599-32", 
    "ComponentTemplateModified" : "2013-01-22T12:34:12", 
    "IsRepositoryPublished" : true
} -->

So I would suggest you experiment with specifying a unique ID in your Start Component Presentation markup, and make sure it differs for each of the CPs on the Page. I'm not 100% certain the ID attribute still exists and will be accepted by XPM, but it is worth a shot. Else its simply something which is not possible in XPM I'm afraid.

  • Nice explanation Bart! – Rajesh Aug 23 '17 at 6:14
  • I have tried to insert a new parameter called "ID" giving it a uniqueid (cp_1 and cp_2) and it doesn't works, so XPM (in SDL Tridion 2013 SP1) doesn't read the parameter ID for distinct one CP to another CP... Thank you guys for your answers, but I think my solution will be to add new CPs to the page, although they are "identique" (a copy of the original Component) – Sergio Alonso Aug 24 '17 at 7:42
  • For that reason, I think this is a XPM issue. – Sergio Alonso Aug 24 '17 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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