13

I'm currently investigating if it's possible to edit component presentations in Experience Manager that exist on pages that are not managed in Tridion - but are existing JSP files in the application. So far I've come up with a couple of issues; with the first being that the "Page Settings" at the bottom of XPM pages wouldn't be present, and neither would the javascript that's included.

<!-- Page Settings: {"PageID":"tcm:17-29114-64","PageModified":"2015-07-22T15:31:35","PageTemplateID":"tcm:17-1091-128","PageTemplateModified":"2015-07-22T20:16:46"} -->
<script type="text/javascript" language="javascript" defer="defer" src="http://cms.tridion.com/WebUI/Editors/SiteEdit/Views/Bootstrap/Bootstrap.aspx?mode=js" id="tridion.siteedit"></script></body>

I manually added the snippet onto a blank JSP which renders out a DCP via the CD API and found out that I could actually still edit the components I am looking to edit. If I add a Component to the page, it's actually added to the page whose ID matches the 'Page Settings' ID as you would expect.

Based on that, I am wondering if creating a "Dummy" page whose pageID we could pass into the 'Page Settings' would be a viable solution for the requirement. I understand none of the "Insert Content" functionality would work obviously (we'd be adding components to the dummy page), but are there other major drawbacks to this approach?

The problems I can see:

  • We'd have a dummy page published out with no contents that should be inaccessible (unless someone mistakenly adds one while editing the pages not published from the CM).
  • We would have to add some logic to only add the XPM 'Page Settings' and JS include in our development environments, whereas Tridion typically handles this.

This approach is a bit of a hack, although it seems it would work. If you're wondering why we're trying to achieve this; the client publishes out content snippets from Tridion and due to the large number of them, they'd like to be able to quickly edit them without looking them up in the CM. I'm interested to hear whether or not anyone has done something similar - or if anyone can come up with any problems we might run into with this approach.

  • @MiguelMiguelez might call it a customization, similar to the third Portal Integration Scenario. – Alvin Reyes Jul 25 '15 at 12:47
  • How do Finish Editing and Session Preview work with your setup? These rely on detecting changes between items and timestamps, but I'm not sure if having a page matters. Normally Finish Editing shows when it detects unsaved changes and running it would save the page and publish it, along with its DCPs. – Alvin Reyes Jul 25 '15 at 13:05
  • is is not a duplicate of tridion.stackexchange.com/questions/2147/… ? – Bart Koopman Jul 27 '15 at 13:03
  • It looks like it is Bart; I searched for awhile but couldn't find anything on the problem but it looks as though I was wrong. – Josh Hebb Jul 27 '15 at 13:33
  • @AlvinReyes - that's a good question. I don't think having a page actually matters; both the component and page "XPM Comments" have modified attributes, so I assume it works on both levels. I am able to edit the components enabling the "Finish Editing" so I think our assumption is safe. – Josh Hebb Jul 27 '15 at 13:39
9

When rendering your SiteEdit ComponentPresentation command, you need to use the json attribute "IsRepositoryPublished" : true. Add this command above the div that will contain your DCP.

For the page command use tcm:0-0-0.

Finally, at the bottom of the page add the reference to the XPM Bootstrap.js URL.

7

So it turns out that Nick is correct, but because XPM operates in the context of a page - you do need to page a PageID added into the XPM "Page Settings" comment. So to summarize:

  • The JS needs to be added manually to the page.
  • The "Page Settings" needs to be added manually as well, passing in a pageID; which will be the ID of the dummy page we create. All pages hosted outside XPM will use this same pageID.
  • The "IsRepositoryPublished" property should be set to "True" - added by the "Enable Inline Editing for Content" if the template is set to dynamic.

After that, the components on the page hosted in the application will be editable via XPM.

  • 2
    You should also set IsQueryBased to true in the XPM markup of the Component Presentation, indicating it is not present on the (dummy) Page and generated by a query. – Bart Koopman Jul 27 '15 at 12:59
3

I'd say the benefits likely outweigh the problems.

Some things to consider:

  • There is a very minor issue where tcm:0-0-0 means links can't resolve correctly and can't be cached
  • You might have issues with the breadcrumb
  • You should be able to publish individual DCPs (click on them first)

Also, consider offering ways to filter and find other DCPs. You might also use page types to let editors create sets of pre-filled Component Presentations. Note that this would only generate the specific DCPs for the templates used on the page.

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.