Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jon 92 posts 166 karma points
    Feb 08, 2021 @ 10:52
    Jon
    0

    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

  • Malthe Petersen 68 posts 383 karma points c-trib
    Feb 08, 2021 @ 17:46
    Malthe Petersen
    1

    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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies