private void Instance_PublishingPage(object sender, ContentEventArgs e) { if (e.Content is SBRobotsTxt content) { Task.Run(async() => await SeoHelper.AddRoute()); } }
public void Initialize(InitializationEngine context) { var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>(); try { if (!ContentReference.IsNullOrEmpty(ContentReference.StartPage)) { var content = contentRepository.GetChildren <SBRobotsTxt>(ContentReference.StartPage); if (content != null) { var list = content.ToList(); if (list.Any()) { Task.Run(async() => await SeoHelper.AddRoute()); } } } } catch (Exception ex) { LogManager.GetLogger().Error("SEOBOOST Initialization", ex); } }
private void ContentEvents_MovingContent(object sender, ContentEventArgs e) { if (e.Content is SBRobotsTxt) { if (e.TargetLink.ID != ContentReference.WasteBasket.ID) { Task.Run(async() => await SeoHelper.AddRoute()); } else { Task.Run(async() => await SeoHelper.RemoveRoute()); } } }