CQ5 “disable” linkcheker

Linkcheker it’s a very useful functionality that highlight to the author eventual broken links within, for example, a RichText widget. However when integrating already existent web application behind apache, there’s the need to “disable” completely it.

We won’t go to disable it properly but configuring it in a way that for him all links are not to be checked.

In CQ5.4, go into the Felix console and click con components (http://$server:$port/system/console/components) and search for: com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl. Click on the wrench (settings) and in the link check override patterns add the following regex (using the “+” button):

^.*$

Save and refresh the page in the author.

This will save the settings into the file crx-quickstart/launchpad/config/com/day/cq/rewriter/linkchecker/impl/LinkCheckerImpl.config.

This will work, but it will disable the Apache Sling JCR Resource Resolver as well, as it uses the LinkChecker service behind the scenes to transform the links.

A more intelligent approach is to use a negative RegEx saying to LinkChecker to ignore everything that is not in our /content/sitename. Use this regular expression:

^((?!/content/sitename).)*$

Replacing sitename with your correct path.

If you want to set the config into the CRX repository (so it can be exported/imported via package manager)  go to /libs/cq/linkchecker/config/com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl using Content Explorer and edit the property service.check_override_patterns adding the regex previously mentioned.

Easy peasy! 🙂