Externalizing URL for a multilingual site | Community
Skip to main content
salvadorm142499
New Participant
October 16, 2015
Solved

Externalizing URL for a multilingual site

  • October 16, 2015
  • 1 reply
  • 1764 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Tomasz_Sobczyk

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#map(javax.servlet.http.HttpServletRequest, 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.

1 reply

Tomasz_SobczykAccepted solution
New Participant
October 16, 2015

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#map(javax.servlet.http.HttpServletRequest, 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.