1

I wanted my sitecore item to publish only a particular language version. For example, I have english and French, but I only want to publish the French language. My plan is to set the "Publishable To" fields of that particular language from "Publishing Settings".

enter image description here

I wanted that way so that if someone accidentally publishes the root item, it won't publish the languages of the child items that shouldn't be published just yet. Is this possible?

I have tried this:

item.Publishing.UnpublishDate = DateTime.Now;

But I this refers to the shared field of the item, not the one from the "Publishing Settings"

enter image description here

1

Fields which determine when given language version is publishable are Valid From and Valid to from the Lifetime section:

enter image description here

You can edit them using:

item.Publishing.ValidFrom
item.Publishing.ValidTo

or

item.Fields[Sitecore.FieldIDs.ValidFrom]
item.Fields[Sitecore.FieldIDs.ValidTo]

alternatively you can use Hide Version field from the Lifetime section:

enter image description here

and set it using

item.Publishing.HideVersion

You need to make sure that you set that values for every item which should not be published in that language. It's not enough to set it on root level only.

  • Thanks! It worked! – Tofu Jul 8 at 7:39

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.