简体   繁体   English

查找Adobe CQ5.5 SP 2.1中所有创作的链接(组件输入和直接html)的断开链接(内部)。

[英]Find broken links (internal) for all authored links (components input & straight html) in Adobe CQ5.5 SP 2.1

We ran into an issue after installing SP2.1 on CQ5.5 which effects references update for all pages under a page that has been renamed using the "websites" console of CQ5. 在CQ5.5上安装SP2.1之后,我们遇到了一个问题,该问题影响使用CQ5的“网站”控制台重命名的页面下所有页面的引用更新。 The issue is described here: 问题描述如下:

http://blogs.adobe.com/dmcmahon/2012/12/13/cq5-5-sp2-1-linksreferences-are-not-updated-following-moverename/ http://blogs.adobe.com/dmcmahon/2012/12/13/cq5-5-sp2-1-linksreferences-are-not-updated-following-moverename/

The hotfix fixes future page name changes and updates the references in all other pages , whether the links are authored as html directly or through input widgets such as "pathfields". 该修补程序修复了将来的页面名称更改,并更新了所有其他页面中的引用,无论这些链接是直接创作为html还是通过输入小部件(例如“ pathfields”)编写。

However , we have discovered this bug pretty late and there have been lot of page re-naming done which resulted in broken links on existing pages where we have used pathfield component in dialog boxes for authors to refer to other pages. 但是,我们发现该错误的时间很晚,而且很多页面重命名都已完成,这导致现有页面上的链接断开,我们在对话框中使用对话框中的pathfield组件让作者引用其他页面。 I would like to write some custom code using the LinkChecker api under the com.day.cq.rewriter.linkchecker package. 我想使用com.day.cq.rewriter.linkchecker包下的LinkChecker api编写一些自定义代码。 I am not able to find any sample code that CQ5 actually uses to perform the "reference updates" on page renames , to serve as a starting point. 我找不到CQ5实际上用于执行页面重命名(作为起点)上的“参考更新”的任何示例代码。

I need inputs based on your experience , whether Linkchecker API is the best way forward or if there is some other API for checking all the authored links and generate a report on which links / pathfields have broken links . 我需要基于您的经验的输入,无论Linkchecker API是最好的前进方式还是是否有其他API可以检查所有创作的链接并生成有关链接/路径字段断开链接的报告。

Help appreciated. 帮助表示赞赏。

I have checked: 1. the external link checker tool, which does report broken links, but only if the link is to some other external domain, so not useful in our case. 我已经检查了:1.外部链接检查器工具,它确实报告断开的链接,但仅在链接指向其他外部域的情况下才可用,因此在我们的情况下不起作用。

Linkchecker is a Sling rewriter. Linkchecker是Sling重写程序。 Rewriters are strictly associated with the request. 重写者与请求严格相关。 They operate on the HTML code generated by the CQ before it's returned to the client. 它们在返回给客户端之前,对CQ生成的HTML代码进行操作。 If I understand correctly, you want to look for broken internal links in the whole site and the Linkchecker won't be very useful here. 如果我理解正确,那么您想在整个站点中查找损坏的内部链接,而这里的Linkchecker并不是很有用。

Consider using Groovy console to crawl over the /content/your_site looking for strings starting with /content . 考虑使用Groovy的控制台爬过的/content/your_site寻找开头的字符串/content Then use resourceResolver to check if the found path exists. 然后使用resourceResolver检查找到的路径是否存在。 Sample script implementing this algorithm can be found here . 实现此算法的示例脚本可在此处找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM