Expand my Community achievements bar.

SOLVED

Externalizing URL for a multilingual site

Avatar

Level 3

Hi all,

I am defining the externalizer configuration for a multilingual site.

My problem comes up when I try to externalize a path to different domains. How do I externalize an URL to www.mycompany.com/page1.html or www.mycompany.es/page1.html???

I have already created an externalizer tag to externalize URLs, so, I have thought to create a 'multisite' special domain that is specially treated in my tag. Something like:

If ('multisite'.equals(domain)){

    path = currentPage.getPath;

    if (path.contains(SPANISH_MARKET_IDENTIFIER)) {

        return externalizer.externalLink(resourceResolver, 'spain', scheme, "/page1") + ".html";

    } elseif (path.contains(FRENCH_MARKET_IDENTIFIER)) {

         return externalizer.externalLink(resourceResolver, 'france', scheme,  "/page1") + ".html";

    }

}

And then my externalizer config file will have an entry on externalizer.domains for each country. It sounds like a very hand made solution. Any other solution/idea???

Thanks in advance,

Salva.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Salvador,

Few things to validate:

1. Do you have seperate cache set up for each domain on Dispatcher level (you will need it).

2. Secondly what's your real requirement? Every link on a page that you display should have an url containing domain instead of just /page.html -> absolute url?

3. You should utilize Sling mapping to have a flexible connection from content to domain. Once you have that, write your own Sling Rewriter (https://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html). Inside your rewriter, for each internal link (starting with /) find it's resource and then do a mapping (https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/org/apache/sling/api/resource/ResourceResolver.html#..., java.lang.String) to get a full (external) url.

 

I'm not sure if you are familiar with the topics I mentioned above. If it doesn't make too much sense for you after getting trough those materials give a shout.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

Hi Salvador,

Few things to validate:

1. Do you have seperate cache set up for each domain on Dispatcher level (you will need it).

2. Secondly what's your real requirement? Every link on a page that you display should have an url containing domain instead of just /page.html -> absolute url?

3. You should utilize Sling mapping to have a flexible connection from content to domain. Once you have that, write your own Sling Rewriter (https://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html). Inside your rewriter, for each internal link (starting with /) find it's resource and then do a mapping (https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/org/apache/sling/api/resource/ResourceResolver.html#..., java.lang.String) to get a full (external) url.

 

I'm not sure if you are familiar with the topics I mentioned above. If it doesn't make too much sense for you after getting trough those materials give a shout.