Publish one Culture picks up all cultures in ContentService.Published
Hi,
We have a site that uses an external search agent and we need a way to Index a page when a page is Published.
We have 2 cultures, English and Welsh. We are currently hooking into the ContentService.Published event but I cant see a way how we can only Index the correct Published Culture. For example: English is the Default language BUT when we publish ONLY the Welsh culture BOTH cultures are picked up in the Event.
Is there a way to only Index the correct culture?
We are currently using this:
private void IndexPage(ContentPublishedEventArgs e)
{
// Find the core settings page
int thisPage = e.PublishedEntities.Select(x => x.Id).FirstOrDefault();
var umbracoHelper = Umbraco.Web.Composing.Current.UmbracoHelper;
IPublishedContent currentPage = umbracoHelper.Content(thisPage);
foreach (string lang in currentPage.Cultures.Keys)
{
IndexHelper inHelper = new IndexHelper();
inHelper.AddPageToIndex(currentPage.Url(lang), thisPage, lang);
}
}
Publish one Culture picks up all cultures in ContentService.Published
Hi, We have a site that uses an external search agent and we need a way to Index a page when a page is Published.
We have 2 cultures, English and Welsh. We are currently hooking into the ContentService.Published event but I cant see a way how we can only Index the correct Published Culture. For example: English is the Default language BUT when we publish ONLY the Welsh culture BOTH cultures are picked up in the Event.
Is there a way to only Index the correct culture?
We are currently using this:
Thanks
Hi Jon.
You can check for each culture whether it has been published in the current event, by calling a method on the event args.
I have answered one of your previous posts with how to check what culture(s) that has been published.
https://our.umbraco.com/forum/using-umbraco-and-getting-started/104998-contentservicepublished-get-culture-language-of-published-page
Hope this can get you further.
Regards
is working on a reply...