Link Checker is configured to take no action if a link is broken. In this case, how do I disable the external link checker from validating links? In doing CPU profiling and analyzing thread dumps, link checking is affecting performance, and we'd like to turn it off.

Disable the link checking of URLs using regular expressions

The link checker can be configured in such a way as to ignore all links from being processed.

The following configuration below is specific for the publish instance. To configure for author, change the path from ../config.publish/.. to ../config.author/... The steps below are done from within the CRX Content Explorer.

  1. Create a configuration node (with node type sling:OsgiConfig) in the project ( /apps/appname/config.publish/{OSGi service PID})
  2. Alternatively, you can copy the one from /libs/cq/linkchecker/config.author/com.day.cq.rewriter.linkchecker.impl.LinkCheckerImplin the config folder of your choice (that is /apps/myapp/config.publish)
  3. Change the property service.check_override_patterns from "^system/" to "^."
  4. Delete all nodes under /var/linkchecker to stop the link checker from periodically rechecking URLs
  5. If the configuration was done on the author, then make a package and install it on your publish instances as well.

참고:

If you use service.check_override_patterns, then the Link Checker still checks the URL to see if it is a valid in terms of the characters and structure. However, in CQ5.4 and later versions you can use service.special_link_patterns=".*" instead of service.check_override_patterns="^." to avoid the validity check.

참고:

When applying this configuration, be careful what regular expression you use.  The example regular expression above disables all link checking and link rewriting. So if you are using the JCR Resource Resolver or /etc/map mappings to rewrite links on your site then this configuration disables those rewrites.  See below for other options.

Adding this code in your page component jsp prevents external link checking from being done by calling LinkCheckerSettings.fromRequest(slingRequest).setIgnoreExternals(true).  In most cases, you would only implement it on publish instances, not author.  So here is some code to demonstrate:

<%
org.apache.sling.runmode.RunMode runmode = sling.getService(org.apache.sling.runmode.RunMode.class);
String[] runmodes = runmode.getCurrentRunModes();
boolean isPublish = false;
String [] expectedRunModes = {"publish"};
if(runmode.isActive(expectedRunModes)) {
isPublish = true;
}

if(isPublish) {
LinkCheckerSettings s = LinkCheckerSettings.fromRequest(slingRequest);
s.setIgnoreExternals(true);
}
%>

If you only want to disable the link checking for a specific component or part of the page, then you can re-enable it again with this code:

<%
s.setIgnoreExternals(false);
%>

Disable all link checking by configuration

  1. If running CQ5.5 SP2.1 then continue. If you are running CQ5.6.1, then install Hot Fix NPR-3751 (See here for some details on hot fixes)
  2. Go to /system/console/configMgr and login as admin
  3. Find the "Link Checker Transformer"
  4. Check the "Disable Checking" box and save
  5. Go to /crx/explorer and login as admin
  6. Open "Content Explorer"
  7. Browse to /var/linkchecker
  8. Right click the node and select "Delete Recursively"
  9. Click "Save All"

참고:

Using this method, you can disable all link checking without disabling link rewriting.

이 작업에는 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License의 라이센스가 부여되었습니다.  Twitter™ 및 Facebook 게시물은 Creative Commons 약관을 적용받지 않습니다.

법적 고지 사항   |   온라인 개인 정보 보호 정책