0

We want to disable Page from publishing in certain Publication when include child Publications is marked true using the Event System.

4
  • Should pages still be published if queued from within that Publication? If not, I would recommend disabling publishing on that Publication. Otherwise what you have set up and tried so far with an event handler? An alternative is a custom resolver to change what gets queued when Publishing items.
    – Alvin Reyes
    May 25 '20 at 14:04
  • Not all the pages from that publication are to be disabled but only the certain types of pages should be disabled in certain publication.
    – Binod
    May 25 '20 at 14:09
  • Okay, if you'd be okay with grouping such "unpublishable" pages in select Structure Groups, you could uncheck the SG Publishable option to prevent publishing. Otherwise a custom resolver or event system would be a good fit.
    – Alvin Reyes
    May 26 '20 at 9:59
  • Also, any details on what determines something should be publishable are appreciated. Is that based on the page template selection, certain metadata, keywords, or some other attributes that define those unpublishable page types? This could help with the answer and give us some insight into future plans for data publishing feature to be introduced in Sites 9.5.
    – Alvin Reyes
    May 27 '20 at 8:09
3

I would use a custom resolver to achieve this. This is a class which is executed after an item has been put in the publish queue, but before it is rendered and transported to the deployer. They are easy to do and very flexible.

The following example might get you started (with the usual 'works on my machine' caveat):

namespace SelectiveChildResolver
{
    using Tridion.ContentManager;
    using Tridion.ContentManager.Publishing;
    using Tridion.ContentManager.Publishing.Resolving;
    using Tridion.Logging;
    public class SelectiveChildResolver : IResolver
    {
        public void Resolve(IdentifiableObject item, ResolveInstruction instruction, PublishContext context, Tridion.Collections.ISet<ResolvedItem> resolvedItems)
        {
            Logger.Write($"Starting SelectiveChildResolver for item {item.Title} ({item.Id})", "Resolver", LoggingCategory.General);
            if (context.Publication.Id == "tcm:0-999-1") // TODO: make this configurable
            {
                resolvedItems.Clear();
            }
        }
    }
}

You need to sign the project and put it in the Tridion bin folder or in the GAC, whichever you prefer. You need to find out the public key token for it, and then configure it in the TridionContentManager.config (google the documentation for that).

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.