public override void Unpublished(PublishContentContext context, AutoroutePart instance)
 {
     if (!String.IsNullOrWhiteSpace(instance.Path))
     {
         _entries.RemoveEntry(instance.ContentItem.ContentItemId, instance.Path);
     }
 }
 public override void Unpublished(PublishContentContext context, AutoroutePart part)
 {
     if (!String.IsNullOrWhiteSpace(part.Path))
     {
         _entries.RemoveEntry(part.ContentItem.ContentItemId, part.Path);
     }
 }
        public override void Unpublished(PublishContentContext context, AutoroutePart part)
        {
            if (!String.IsNullOrWhiteSpace(part.Path))
            {
                _entries.RemoveEntry(part.ContentItem.ContentItemId, part.Path);

                // Evict any dependent item from cache
                RemoveTag(part);
            }
        }
Exemple #4
0
        public override Task UnpublishedAsync(PublishContentContext context, AutoroutePart part)
        {
            if (!String.IsNullOrWhiteSpace(part.Path))
            {
                _entries.RemoveEntry(part.ContentItem.ContentItemId, part.Path);

                // Evict any dependent item from cache
                return(RemoveTagAsync(part));
            }

            return(Task.CompletedTask);
        }
Exemple #5
0
        public override async Task PublishedAsync(PublishContentContext context, AutoroutePart part)
        {
            // Remove entry if part is disabled.
            if (part.Disabled)
            {
                _entries.RemoveEntry(part.ContentItem.ContentItemId, part.Path);
            }

            // Add parent content item path, and children, only if parent has a valid path.
            if (!String.IsNullOrWhiteSpace(part.Path) && !part.Disabled)
            {
                var entriesToAdd = new List <AutorouteEntry>
                {
                    new AutorouteEntry(part.ContentItem.ContentItemId, part.Path)
                };

                if (part.RouteContainedItems)
                {
                    _contentManager ??= _serviceProvider.GetRequiredService <IContentManager>();

                    var containedAspect = await _contentManager.PopulateAspectAsync <ContainedContentItemsAspect>(context.PublishingItem);

                    await PopulateContainedContentItemRoutes(entriesToAdd, part.ContentItem.ContentItemId, containedAspect, context.PublishingItem.Content as JObject, part.Path, true);
                }

                _entries.AddEntries(entriesToAdd);
            }

            if (!String.IsNullOrWhiteSpace(part.Path) && !part.Disabled && part.SetHomepage)
            {
                await SetHomeRoute(part, homeRoute => homeRoute[_options.ContentItemIdKey] = context.ContentItem.ContentItemId);
            }

            // Evict any dependent item from cache
            await RemoveTagAsync(part);
        }