Exclude expired content from the Link Status report

Vote:
 

Hi 

Currently the Link Status report shows broken links that are present on expired pages and blocks. Can broken links that are on expired content be ignored by the report as our clients don't need to fix content issues that aren't visible by anyone?

Thanks

Jonathan.

#191809
Apr 30, 2018 8:29
Vote:
 

+1 

Need something similar. Not sure if anyone's implemented something like this without having to create a custom report from scratch.

#206321
Aug 13, 2019 22:03
Vote:
 

I think you could do it if you're willing to accept the risk of overriding an internal class. If you override/intercept ILinkRepository (in EPiServer.LinkAnalyzer.Providers.Internal.ILinkRepository) you could add in a check there like this:

public class CustomLinkRepo : LinkRepository
{
    public CustomLinkRepo(IContentSoftLinkRepository repository, IContentSoftLinkStatusService statusService) : base(repository, statusService)
    {
    }

    public override IEnumerable<SoftLink> GetUncheckedLinks(DateTime lastCheckedDate, TimeSpan ignoreWorkingLinksInterval, int maxNumberOfLinks)
    {
        var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
        var unfilteredLinks = base.GetUncheckedLinks(lastCheckedDate, ignoreWorkingLinksInterval, maxNumberOfLinks);
        return unfilteredLinks.Where(l => contentLoader.TryGet<IContent>(l.OwnerContentLink, out IContent content) && !new EPiServer.Filters.FilterPublished().ShouldFilter(content));
    }
}

Which you could register like this:

[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class LinkRepoInitialisation : IConfigurableModule
{
    public void ConfigureContainer(ServiceConfigurationContext context)
    {
        context.ConfigurationComplete += (o, e) =>
        {
            context.Services.AddTransient<ILinkRepository, CustomLinkRepo>();
        };
    }
    public void Initialize(InitializationEngine context) { }
    public void Uninitialize(InitializationEngine context) { }
}
#206328
Aug 14, 2019 14:54
Vote:
 

Good request, seconded! +1

#207143
Sep 11, 2019 11:21
Vote:
 

+1

#230699
Nov 11, 2020 20:28
This thread is locked and should be used for reference only.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.