Expand my Community achievements bar.

SOLVED

Finding path references on a CQ page

Avatar

Community Advisor

Hi,

CQ has amaizing Link Checker service that does something similar already. E.g. it finds all the links on a page and checks whether they are valid. That's exactly what is needed, what service is it using underneath to find the links on a page ?

Is there a service that returns all the page path references found on a page. ?

Thanks,

Peter

1 Accepted Solution

Avatar

Correct answer by
Level 7

Link checker service (which is a rewriter implementation) in part of the rewrite pipeline. The sling re-write pipeline is rewriting the output generated by the AEM pages.
To read more about rewriting pipelines take a look at this document: http://sling.apache.org/site/output-rewriting-pipelines-orgapacheslingrewriter.html

AFAIK, this implementation traverses the content that goes out on the pages and works its magic on links :)

/Johan

View solution in original post

4 Replies

Avatar

Employee

Johan is correct - the Link Checker has a rewriter pipeline component which looks at all of the <a> and <form> tags on a page (there might be one or two others) and looks at the appropriate HTML attribute to extract the link.

These links could be hard-coded in the JSPs or they could be dynamic based on authored content. The rewriter doesn't know or care -- it just sees the HTML.

If you want something which is more content-orientated, you can use the implementations of the ReferenceProvider (http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/wcm/api/reference/ReferenceProvider.html) service. These look at the content itself. This is what is used to warn you about unactivated assets when you activate a page. You can write your own ReferenceProviders if you want to add other items to that warning dialog.

Avatar

Correct answer by
Level 7

Link checker service (which is a rewriter implementation) in part of the rewrite pipeline. The sling re-write pipeline is rewriting the output generated by the AEM pages.
To read more about rewriting pipelines take a look at this document: http://sling.apache.org/site/output-rewriting-pipelines-orgapacheslingrewriter.html

AFAIK, this implementation traverses the content that goes out on the pages and works its magic on links :)

/Johan

Avatar

Community Advisor

Awesome, thanks for excellent replies !