public void OnItemDeleting(object sender, EventArgs args)
        {
            Assert.ArgumentNotNull(sender, "sender");
            Assert.ArgumentNotNull(args, "args");

            Item item = Event.ExtractParameter(args, 0) as Item;

            if (item == null)
            {
                return;
            }

            if (item.Database.Name == "master")
            {
                return;
            }

            //Add condition(s) to include only Templates that hold short-lived content. Eg: Events, Job Posting
            //Ensure that the respective pages follow Google Structured Data Standards (https://developers.google.com/search/docs/data-types/video#broadcast-event , https://developers.google.com/search/docs/data-types/job-posting)
            var urlOptions = new ItemUrlBuilderOptions()
            {
                AlwaysIncludeServerUrl = true
            };
            var deletedLink = item.GetUrl(_linkProvider, urlOptions);

            if (!string.IsNullOrEmpty(deletedLink))
            {
                IndexingAPIHelper.SendIndexingRequest(deletedLink, "URL_DELETED");
            }
        }
Ejemplo n.º 2
0
        public override void Process(PublishContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            if (context.Aborted)
            {
                return;
            }

            if (context.Statistics.Created > 0 || context.Statistics.Updated > 0)
            {
                List <ID>     modifiedItemIDs = context.ProcessedPublishingCandidates.Keys.Select(i => i.ItemId).ToList();
                List <string> modifiedLinks   = FetchModifiedLinks(context, modifiedItemIDs);
                IndexingAPIHelper.SendIndexingRequest(modifiedLinks, "URL_UPDATED");
            }
        }