AI OnAI Off
+1
Need something similar. Not sure if anyone's implemented something like this without having to create a custom report from scratch.
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) { }
}
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.