Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Link Rewriter not rewriting the link if the link was added via a model property.

Avatar

Level 1

Hi Experts,

     We have recently upgraded to 6.3 latest SP2 for 6.1. The issue we are noticing is that in the publishing environment when any link (<a href: "/content/**") generated  using a sling model attribute, those links are not getting re-written after applying the resource resolver mapping rules.

This was not an issue on 6.1. Did anything change? How can this be addressed with out changing all our components to use a resolvedpath?

Rama.

2 Replies

Avatar

Employee Advisor

The rewriting happens at the output level (on the rendered HTML). Is this reproducible on all your environments? And have you checked that all relevant settings for the link-rewriter are set correct?

Jörg

Avatar

Level 1

Hi Jörg,

         The link-rewriter settings seem to be correct as the re-writing is happening at some places and not at some places and there is no specific pattern on where and when it happens. Also the 'stripHtmlExtention' property also seems to be not respected in some places. But there was no pattern to it. We found what lines of code was causing the issue and handled those lines differently.

@Component(label = " Environment",

        description = " Environment Properties: Any environment related configuration will go here. This is based on runmodes.",

        immediate = true)

@Service(EnvironmentProperties.class)

public class EnvironmentPropertiesImpl implements EnvironmentProperties {

...

...

...

...

    private boolean stripHtmlExtension;

    @Reference

    private ConfigurationAdmin configAdmin;

    public boolean isStripHtmlExtension() {

        return stripHtmlExtension;

    }

   public void setStripHtmlExtension(boolean stripHtmlExtension) {

        this.stripHtmlExtension = stripHtmlExtension;

    }

...

...

...

    @Activate

    protected void activate(final Map<String, Object> config) {

...

...

...

...

        stripHtmlExtension = false;

        try{

            org.osgi.service.cm.Configuration conf = configAdmin.getConfiguration("com.day.cq.rewriter.linkchecker.impl.LinkCheckerTransformerFactory");

            stripHtmlExtension = PropertiesUtil.toBoolean(conf.getProperties().get("linkcheckertransformer.stripHtmltExtension"),false);

        }catch (Exception e){

            e.printStackTrace();

            stripHtmlExtension = false;

        }

...

...

...

...   

    }

}   

In the above lines of code, we are trying to read the property for 'linkcheckertransformer.stripHtmltExtension'. After the execution of this line in the activate method then we are seeing the odd behavior that we were experiencing. It effected the out of the box site, weRetail as well. The links there too were showing up with full content path.  As of now we changed these lines of code.

Rama.