« Back

Localize Layout Friendly URLs

Company Blogs August 7, 2013 By Sergio González Staff

Lately I have been working on a new feature that many users have asked for a long time and Liferay didn't support it (yet).

As most of you know, friendly URLs are very important nowadays for several reasons, although I would say that the two most important ones are:

  • SEO: it definitely improves the ranking of a site when the urls of that site are friendly
  • Usability: from the user point of view, if we have a nice friendly url we provided to the end user with helpful information. Even sometimes, friendly urls can behave as a breadcrumb, and allows the user to modify them and visit the pages they want just by modifying the url. 

In Liferay 6.1 and previous, site admins could add Pages and update friendly URLs for those pages from the UI. However, those friendly URLs were not localizable. This means that, in sites with more than one language, the friendly URL for the pages was useful only for part of the people (people who understand the language the friendly URLs are written)

From 6.2 and on we allow localized friendly urls, so for a single page, we can have many different friendly urls for different locales. Then, for the homepage we could have /home (english) and /inicio (spanish), so when an user whose language is English hits the frontpage, he will see in the url www.example.com/home and if i'ts a Spanish user he will see www.example.com/inicio

 

 

All the links will be generated considering the user language, so the right friendly url will be automatically used for every link. Then, you may be wondering, what will happen if english user copy/paste his URL (www.example.com/home) to his spanish friend? Will the spanish user access the right page? Will he see the content in English? Spanish?

In that case, the user will be automatically redirected to the friendly url in his own language and a non obtrussive message will be displayed for 10 seconds notifying the redirect to the user and allowing him to access the original link.

 

I Hope you like it. I'm looking forward to hear your feedback.

Threaded Replies Author Date
What a great feature. I love to see it getting... Oliver Bayer August 7, 2013 2:50 AM
I hope it will be possible to disable the... Daniel Lupescu August 8, 2013 1:31 AM
Hey Dan, Right now there is no way to disable... Sergio González September 23, 2013 7:48 AM
Hi Sergio, after reading it twice I'm having... Oliver Bayer August 12, 2013 5:04 AM
Hey Oliver, Unfortunatelly we didn't implement... Sergio González September 23, 2013 7:49 AM
Great great feature to SEO improvement in... Miguel Ángel Pau August 23, 2013 3:48 AM
Thanks a lot! This feature got implemented in... Jonas Yuan August 23, 2013 10:45 AM
WIll it be possible to distinguish between... Ewan Gilmour October 7, 2014 1:54 AM
How to disable this? We have just one language... Michal Sima November 5, 2014 3:00 AM

What a great feature. I love to see it getting implemented as I've asked for it several times. Now I "only" have to master the upgrade process ;).
Posted on 8/7/13 2:50 AM.
I hope it will be possible to disable the automatic redirection and modify the 10 seconds duration using properties in the portal-ext.properties.
Posted on 8/8/13 1:31 AM.
Hi Sergio, after reading it twice I'm having one question ;). Is this feature also applied to community/ site names?? It woulbe be really useful if the friendly url of site names could be localized too. Greets Oli
Posted on 8/12/13 5:04 AM.
Great great feature to SEO improvement in portals in many languages !! Thanks!!
Posted on 8/23/13 3:48 AM.
Thanks a lot! This feature got implemented in 6.2 finally.
Posted on 8/23/13 10:45 AM.
Hey Dan,

Right now there is no way to disable the notification message via portal.properties because it's a situation that should rarely occur. Anyways, all the logic to display the message is handled in top_messages.jsp, so you can easily change the behaviour by using a JSP hook.
Posted on 9/23/13 7:48 AM in reply to dan dan.
Hey Oliver,

Unfortunatelly we didn't implement it for site names emoticon
Hopefully we can do it for 6.2.
Posted on 9/23/13 7:49 AM in reply to Oliver Bayer.
WIll it be possible to distinguish between languages in the site using a slash in the URL? For example for the home page - in English we name the page /en/home and in Spanish we name the page /es/inicio . Will it be possible to enter slashes in the URLs in this way?

I am just trying to determine that there will be an easy way we can set different language parts of the site in Google Webmaster Tools. ie. all english pages on /en/ and all Spanish pages on /es/ . What is the best way to facilitate this within Liferay?

Thanks
Posted on 10/7/14 1:54 AM.
How to disable this? We have just one language in the site (French), but it is possible to set friendy URLs for English and French. We do not want this redirection alert to be active.
Posted on 11/5/14 3:00 AM.