Expand my Community achievements bar.

SOLVED

URL shortening in AEM 6.3

Avatar

Level 6

in AEM 6.3, we define the URL mapping in the JcrResourceResolverFactoryImpl.config.xml file. When author selects a content URL as a path in the component dialog,

if we render the url as <a href="${link.url@ extension = 'html'}">, the AEM automatically shortens the url. However, if we remove the extension <a href="${link.url}">, the AEM doesn't shorten the URL.

Just wonder if anyone knows if there is a linker check related configuration to tell adobe only shorten the url when the path has .html?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The URL shortening is a function of the LinkRewriter, and this rewriter acts only links containing an extension. If you omit the extension (e.g. ".html") it's not rewritten.

Jörg

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

The URL shortening is a function of the LinkRewriter, and this rewriter acts only links containing an extension. If you omit the extension (e.g. ".html") it's not rewritten.

Jörg

Avatar

Level 9

Add an exception to the link checker to tell it to ignore certain URL patterns. To do this, do the following:

  1. Log into http://[host]:[port]/crxde as admin
  2. If you do not already have a custom link checker configuration in your application then copy the node /libs/cq/linkchecker/config.author/com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl to /apps/[yourapp]/config/com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl
  3. Select the config node com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl
  4. On the bottom of the right pane, expand the Properties tab
  5. Double click service.check_override_patterns
  6. Add another override pattern for the URL that is being marked invalid
    For Example: if the broken links are all URLs with the hostname www.mycompany.com, then your override pattern would be: ^http://www.mycompany.com/.*
  7. Delete any nodes under /var/linkchecker corresponding to the invalid link's host
    For Example: following the example in the last step, we would delete /var/linkchecker/http/www.mycompany.com
  8. Click Save All

Avatar

Level 6

Thanks Hermant.

I think Jörg answered my question. Your approach will work for single site, I have multiple sites, don't want to put something only applying for one site.

Thanks again.