1

For some reasons, I customized DD4T template building block not to publish multimedia component.

BinaryPublisher's "PublishItem" method publishes multimedia component, so I removed code and added only one line in the method. My code is following.

protected virtual void PublishItem(Item item, TcmUri itemUri)
{
    item.Properties[Item.ItemPropertyPublishedPath] = string.Empty;
}

As a result, multimedia component is not published as I expected.

Also some multimedia components have already been published before template building block is customized, so I want to unpublish them.

When published a component which has link to multimedia component with customized template, I noticed that the multimedia component is unpublished(removed from Broker DB).

This is good for me, but I wonder why multimedia component is unpublished by publishing with the "customized" template.

My questions are following.

  • How does template building block unpublish multimedia component?
  • Is this behaviour(multimedia component is unpublished) expected?

Regards,

2 Answers 2

3

When you publish the item, if the template has a call to AddBinary() the binary will be published, and also some metadata indicating that the binary was published with that specific item.

If you publish it again, this time without the binary, when it is deployed, the metadata will be updated, and of course will reflect the fact that the item no longer uses the binary. If the item is the last one using the binary, then the binary will be removed.

So - yes - this behaviour is expected.

1

+1 to Dom's answer. For a good read, see Frank van Puffelen's explanation for the two ways of placing and removing Multimedia Components (MMCs) to and from delivery:

  • Explicit Publishing, with a Component Template set for the MMC's Schema where editors choose the MMC to publish it directly
  • Implicit Publishing, where the Component or Page Template of the item that references the MMC publishes it (e.g. using the Default Finish Action template building block)

"How does template building block unpublish multimedia component?"

Content delivery keeps tracks of how a binary (Multimedia Component) is used. When pages and content (Dynamic Component Presentations) no longer refer to the binary, it gets removed from storage. Technically it isn't unpublished but rather removed from storage.

"Is this behaviour (multimedia component is unpublished) expected?"

Yes. By having Content Delivery track binary use like this, they will be rendered and removed automatically for editors.

Product-wise, an alternative might be to have something like an "unrender" concept, which would probably add more complexity than needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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