Friday, October 21, 2011

How to make sure that Links are always valid on a page

Use Case: Some time link checker makes certain links as invalid (As it is not able to verify it).

Solution: You can add x-cq-linkchecker="valid" parameter in the <a> tag to make sure that links are always mark as valid by CQ. In this case link checker will check the link but will mark it valid.

You can optionally use x-cq-linkchecker="skip" in the <a> as well. In this case link checker will not even check for validity for link.

There are other options too to make all external link as valid,

Option 2: You can disable external link checker entirely by going to felix console

Option 3: Additionally you can add override pattern to disable link checking for certain domain

Example for override pattern: for you will write ^http://www\.day\.com/

Following error with respect to external link checker, No more external links allowed for host <Host Name> Maximum of 128 reached. means,
External link checker only checks first 128 link per host basis, And you can find those entry under /var/linkchecker/<protocol>. Unfortunately this is not configurable yet.


  1. Hi Yogesh,

    having an issue with the linkchecker & caching of elements on the page. Just wondering if you could give any more info on the x-cq-linkchecker property.

    Had a quick search online, but couldn't find any info on it, apart from one guy using 'skip' as the value.

    What are the possible values & outcomes of these for this attribute?

    Cheers for the help. Will definitely keep an eye on your blog =)


  2. Dave,

    Logic behind this is very simple,

    If you set value to x-cq-linkchecker="skip" , LinkCheckerTransformer service not even check for that link. Whereas if you set it to "valid" link is checked but they are marked valid (So there would be entry under /var/linkchecker for this link but as valid.

    I have updated blog with some more information.

  3. Hi Yogesh,

    cheers for the quick reply. I thought there might be further options that I wasn't aware of that I could pass for the value of the attribute. But sounds like skip will do what I need.

    Thanks, I'll check it out!


  4. Hi Yogesh,
    One of your screenshot displays settings related to the bundle "Day CQ Link Checker Transformer"
    It seems you're able from this form to disable rewriting.
    I've searched everywhere in my felix console and can't find it, is it only available on a specific version of CQ5?

    Also, I was wondering whether unchecking this box would have an impact on internal links rendering and if it was completely safe to disable link checker then. Would you able to explain some of those properties?

    Many thanks for your help.

  5. is it only available on a specific version of CQ5?
    -- Yes. CQ5.4 onward.

    Property names are self explanatory. If you disable link checking and rewriting, Both internal and external links are not checked. And there won't be any effect of configuration under "/etc/map".

    With "Strict Extension Check" checked all the links with suffix will be be strip. For example /content/test.html/test/test will be converted to /content/test.html

    "Map Cache Size" is used to improve performance of link checking. So 5000 mean CQ will create cache Map (Java Map) of max size 5000 to store results of link checking.

  6. Hi Yogesh,
    thanks, it confirms that the internal link and external checker may work in a different way (although it seems they are using both the same transormer).

    1. Yes. It is defined under /libs/cq/config/rewriter/default