Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Link Checker Transformer not stripping html for JavaScript load

Avatar

Level 2

I have the Link Checker Transformer service turned on and the strip html extension option checked in the felix console. It is working as intended except in the following scenario.

I have an unordered list on a page:

<ul><li>Click Here</li></ul>

On clicking "Click Here", an event is triggered that redirects to another URL: /content/mysite/testpage.html using 

jQuery(location).attr('href', "/content/mysite/testpage.html");

In this case, the .html is still dangling around in the URL even after testpage has loaded.

PS: removing ".html" at the end of the URL string cannot be a solution in my case because it will fail in the author mode.

Any help in working with this issue is appreciated. Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee

That makes slightly more sense. You're best bet here is to do something like:

<ul><li data-link="/content/foo.html">Click Here</li></ul>

and then configure the transformer to rewrite data-link (or whatever name) attributes of the li element, just like the href attribute of the a element.

But really, you should just do:

<ul><li><a href="https://forums.adobe.com/content/foo.html">Click Here</a></li></ul>

I'm assuming there's some good reason you can't do this.

View solution in original post

3 Replies

Avatar

Employee

JavaScript content is not rewritten by any of the default rewriter pipeline components.

I'm honestly unclear on what you're trying to accomplish. It seems like you're just using JavaScript to do the same thing that clicking the link would do. Perhaps if you explain what you're trying to accomplish, someone could provide suggestions on how to move forward.

Avatar

Level 2

I have edited my question. There is no anchor tag now. It is a list element. I want to have clean URL's without any .html extensions.

Avatar

Correct answer by
Employee

That makes slightly more sense. You're best bet here is to do something like:

<ul><li data-link="/content/foo.html">Click Here</li></ul>

and then configure the transformer to rewrite data-link (or whatever name) attributes of the li element, just like the href attribute of the a element.

But really, you should just do:

<ul><li><a href="https://forums.adobe.com/content/foo.html">Click Here</a></li></ul>

I'm assuming there's some good reason you can't do this.