Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
Is it possible to know which language variant of the page that has been published in the ContentService.Published event?
I need to post the Culture name to a search index when the page has been published.
Thanks
Jon
Hi Jon.
What you can do is:
Loop through the availableCultures on the IContent. Then there is a method to check if the culture has been published in this event or not.
You can see how we do it here on line 139: https://github.com/enterspeedhq/enterspeed-source-umbraco-cms/blob/master/src/Enterspeed.Source.UmbracoCms.V8/Components/EnterspeedContentEventsComponent.cs#L139
This is for unpublishing, but an equal exist for publish, something like: e.HasPublishedCulture(content, culture)
You can see them here for the ContentPublishedEventArgs: https://github.com/umbraco/Umbraco-CMS/blob/aa5470a801107de2046454612f42bc02f9672099/src/Umbraco.Core/Events/ContentPublishedEventArgs.cs#L9
Hope this helps.
Regards Malthe
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
ContentService.Published - Get culture language of published page
Hi,
Is it possible to know which language variant of the page that has been published in the ContentService.Published event?
I need to post the Culture name to a search index when the page has been published.
Thanks
Jon
Hi Jon.
What you can do is:
Loop through the availableCultures on the IContent. Then there is a method to check if the culture has been published in this event or not.
You can see how we do it here on line 139: https://github.com/enterspeedhq/enterspeed-source-umbraco-cms/blob/master/src/Enterspeed.Source.UmbracoCms.V8/Components/EnterspeedContentEventsComponent.cs#L139
This is for unpublishing, but an equal exist for publish, something like: e.HasPublishedCulture(content, culture)
You can see them here for the ContentPublishedEventArgs: https://github.com/umbraco/Umbraco-CMS/blob/aa5470a801107de2046454612f42bc02f9672099/src/Umbraco.Core/Events/ContentPublishedEventArgs.cs#L9
Hope this helps.
Regards Malthe
is working on a reply...