4

Just wanted to check, is it a best practice to add items (ResolvedItems) to ResolvedItems list in a Custom Resolver? Or the Custom Resolver is to be used only for removing Resolved Items for the list?

  • Interesting. Which posts or info made it seem like Custom Resolvers were only for removing items? – Alvin Reyes Mar 3 '18 at 20:58
  • I've heard a few recommend the Event System over a Customer Resolver to change the Publishing Queue for performance reasons, but I have to defer to others to better explain why (it was something about checking fewer items). – Alvin Reyes Mar 3 '18 at 21:06
5

If your question is how to publish additional items together with your item, then, just like everything else in Tridion, you have multiple options, where choosing one depends on your implementation, preferences, maintenance capability etc. So how you can achieve this:

  1. As you and Bart stated, yes, you can use a Custom Resolver to add items during publishing. This indeed will result in additional item being published withing the current transaction.
  2. You can create an Event System that will publish the additional item separately, so that way you will have 2 transactions in the Publishing Queue, which is OK if you want to have it more clearly stated to editors and publishing of both items together is not mandatory.
  3. there is also and option 3, where you can use the Publishing Engine to add items during publishing. Withing your Component/Page Template, you can add an additional Dreamweaver template (DWT) which will execute RenderComponentPresentation() over the additional item (if its a Component). Later on you can add your regular DWT which will generate the Output. SO what is the purpose of this and what you get? Basically, you achieve that your second Component is in the Package, so it will processed and published with the Template you have specified. You don't have to link it in your main Component, you can just have it read via Engine and pushed into Package and then rendered.

So whichever way you choose to go, please be aware that most problems/frustrations you can have in maintenance phase when after few months/years everyone forget what they were doing in implementation. As for me, I saw all 3 options implemented. :)

  • #3 also happens for Pages with Dynamic Component presentations where publishing the page will add its DCPs to the transport package. I'm fuzzy if you actually need theRenderComponentPresentations() calls. I suspect that pages publish their embedded DCPs automatically. – Alvin Reyes Mar 3 '18 at 21:01
  • yes @AlvinReyes that is correct. I was more speaking of situation where one DCP can publish another DCP with it. – Marko Milic Mar 5 '18 at 7:49
  • @Alvin Reyes, actually, when publishing a Page with only static CPs, only the Page is published. You can check this with the Show items to Publish button. In case of pages which have DCPs, the Page and all the DCPs are listed VS only the Page for Pages that have only "static" CPs. CPs don't exist on their own when published as embedded, hence they are not treated separately. – Atila Sos Mar 5 '18 at 11:58
4

A Custom Resolver is for customizing the resolving, this includes adding and removing items indeed.

Personally I think it is more clear when you are adding items in a custom resolver, than removing them. But I have built both types of resolvers and if you make sure the customer understands that there is a custom resolver in play and what it does, it should never cause any unexpected issues.

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.