0

When using Tridion's default link propagation policy, the system is publishing a lot of pages when we only publishing one image. This is because we have family and category pages which are listing all our products. If the image is used in one product, then it propagate to everywhere. We have to write some custom events to stop the link propagation when publishing for component and images, but we would have to publish those images/components individually before publishing the page. Are there a better way to solve those issues? I think we should not be alone in situation like this.

1

It seems, you want to just publish the Images dynamically and not the items where the images are used. If I understand your problem correctly, then I think you should use custom resolver to delete unwanted resolved items while publishing a Image.

In custom resolver code you can manage the resolved Items while publishing. More info about custom resolver could be found here (Login Required)

you can try this piece of code in your custom resolver to remove pages from resolve items while publishing a Image.

     // This Resolve method executes after the default resolver has done its job and produced a set of resolved items.
            public void Resolve(IdentifiableObject item, ResolveInstruction instruction, PublishContext context, Tridion.Collections.ISet<ResolvedItem> resolvedItems)
            {
               //Copy resolved items to an array for looping
                ResolvedItem[] originalResolveItemList = new ResolvedItem[resolvedItems.Count];
                resolvedItems.CopyTo(originalResolveItemList, 0);
                foreach (ResolvedItem resolvedItem in originalResolveItemList)
                {

                    if (resolvedItem.Item is Page)
                    {
                        // remove resolvedItem if item = MM Component
                        if (item is Component)
                        {
                            Component comp = (Component)item;
                            // check if published item is multimedia component and of type Image
                            if (comp.ComponentType == ComponentType.Multimedia && comp.BinaryContent.MultimediaType.MimeType.Contains(@"image\"))
                            {
                            // remove the Page, as the published item is a MM Image

                           resolvedItems.Remove(resolvedItem);

                            }
                        }
                    }
                }
            }
1

You don't necessarily need to publish those items before the pages.

Although Tridion may not resolve certain Component Presentations or images when queuing a page (as seen in Items to Publish), your template code can (and probably currently does) add them to the Template Package.

You may notice this behavior already by publishing a page or component with an image. If that template resolves and adds images to the package (e.g. as seen in the Default Finish Actions Template Building Block) the updated versions will appear in delivery.

I describe the difference in this post, mainly that:

  • SDL Tridion will resolve and include (already published) items for publishing that use your items as you describe (a custom resolver may be a better way to change this behavior)
  • Publishing a page will queue the dynamic component presentations on it
  • Templates can add Component Presentations and images to the package

So this means for your scenario, publishing a page that uses your updated images may be enough to "update it everywhere." The exception would be if your other pages used variations (variants) of the image or if you handle images without adding them to the Template Package (e.g. not using AddBinary() or the Default Finish Actions TBB).

An alternative is referencing content dynamically. Will Price describes the pros and cons for when you may want to use dynamic component presentations in this post. But for images, just publishing one page should be enough.

  • Hi Alvin, Thank you for the post. It is very useful. I know by default we don't have to publishing those images individually. We have added custom events to prevent the link propagation for images (to get around of problem of a lot of pages getting published), we will need to publish those images individually after installing our custom events. – charles May 2 '14 at 17:18
  • Double check your templates and their TBBs to be sure. Even with a custom event or resolver which stops related items (that use your image) from being queued, they won't stop templates from adding images to the package and (implicitly) publishing them. You would still have to publish, but it wouldn't have to be the images in that case. – Alvin Reyes May 2 '14 at 21:33

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.