Tags: CMS12 Optimizely/Episerver

Configuring link validation in Optimizely CMS 12

When Optimizely released version 12 of their CMS, it was not possible to configure how links should be validated. Now it is! 🎉

It's all nicely described in the documentation, but here's a summary.

services.Configure<LinkValidatorOptions>(options => {
          options.ExternalLinkMinimumRequestInterval = TimeSpan.FromSeconds(5);
          options.MaximumRunTime = TimeSpan.Zero;
          options.RecheckInterval = TimeSpan.FromHours(7);
          options.UserAgent = "EPiServer Link Checker";
          options.ProxyAddress = new Uri("http://myproxy.mysite.com");
          options.ProxyUser = "myUserName";
          options.ProxyPassword = "secretPassword";
          options.ProxyDomain = ".mysite.com";
          options.InternalLinkValidation = ValidationType.Api;

The default values for each setting can be found in the configuring cms section. What's not mentioned in the documentation is the most important setting - ExternalLinkErrorThreshold!

Graphical user interface, application

If you have not seen the above error message – consider yourself very lucky! If you have seen it, you'd probably want to ramp up the setting below.

services.Configure<LinkValidatorOptions>(options => {
          options.ExternalLinkErrorThreshold = 1000;

If you want to use IncludePatterns instead of ExcludePatterns, check out my old (but still valid) blog post about the horrors of the Episerver Link Validation job.