Class GenericCanonicalLinkDetector

java.lang.Object
com.norconex.crawler.web.doc.operations.canon.impl.GenericCanonicalLinkDetector
All Implemented Interfaces:
Configurable<GenericCanonicalLinkDetectorConfig>, CanonicalLinkDetector

public class GenericCanonicalLinkDetector extends Object implements CanonicalLinkDetector, Configurable<GenericCanonicalLinkDetectorConfig>

Generic canonical link detector. It detects links from the HTTP headers as well as HTML files. Good canonical reference documentation can be found on this Google Webmaster Tools help page.

HTTP Headers

This detector will look for a metadata field (normally obtained from the HTTP Headers) name called "Link" with a value following this pattern:

 <http://www.example.com/sample.pdf> rel="canonical"
 

All documents will be verified for a canonical link (not just HTML).

Document content

This detector will look within the HTML <head> tags for a <link> tag following this pattern:

 <link rel="canonical" href="https://www.example.com/sample" />
 

Only HTML documents will be verified for a canonical link. By default, these content-types are considered HTML:

 text/html, application/xhtml+xml, vnd.wap.xhtml+xml, x-asp
 

You can specify your own content types as long as they contain HTML text.

The above example ignores canonical link resolution.

Since:
2.2.0