0

We know the Sitecore Media Library will store images. I have a requirement to set the image with an expiry date, if an image used in multiple places, based on expiry the same should not be shown.

What are the OOTB solution available. What are the possible options, to set the Image with Expiry date.

2 Answers 2

1

While the solution from Sitecore Climber might work for you, another option would be to implement it on your own:

Add an "expirydate" field to your

/sitecore/templates/System/Media/Versioned/File

and

/sitecore/templates/System/Media/Unversioned/File

Templates.

Write a processor for the HttpRequestBegin pipeline where you check if you have a mediaitem and the expirydate field is set to a past date. In case its expired, you can either 404 or redirect to another item. You might want to set the fallback item on the file item, so add another field there and you end up with a nice flexible solution.

The advantage compared to publishing restrictions is that you can get second-precise unpublishing more easily and have a fallback item.

1

It doesn't exist such a functionality OOTB. You can use publishing restristriction to unpublish your image at Expiry date.

To set up publishing restrictions for every version and in every language for an item:

In the Content Editor or the Experience Editor, navigate to the item or page that you want to set up publishing restrictions for. 1. Open the Publishing Settings dialog box:

  1. In the Content Editor, on the Publish tab, in the Restrictions group, click Change.

    enter image description here

  2. In the Publishing Settings dialog box, click the Item

enter image description here

Please have a look here: https://doc.sitecore.net/sitecore_experience_platform/content_authoring/publishing/preview_and_setup/set_up_publishing_restrictions_for_an_item for more informations.

1
  • This has one significant drawback: The publishing restrictions only come into effect when publishing, so you need to have some solution in place, e.g. publishing everything every hour or so. Commented Jul 3, 2017 at 12:04

Your Answer

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

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