Can we use the same friendly URL in a page's translations?

Issue

  • We have a page where we want to use the same friendly URL for different translations, but when we try to save the page, it fails with an error:
    • Please enter a unique friendly URL.
  • We understand that the behavior was made by design for SEO purposes, however, we would prefer to use our method, where we have the same URL with different locale prefixes, is that possible?

Environment

  • Liferay DXP 7.3+

Resolution

  • The behavior is intended, however, there is a workaround that might help you if you want to use the same friendly URL in your default language and one of the translations, or if you have a two-language environment. That means you won't be able to do this with two translations.
  • The trick is that if you leave a translation's friendly URL empty, it will be populated with the default language's friendly URL. 
  • Please check the below steps (English was the site's default language in this case and we used the locale.prepend.friendly.url.style=2 property, where the language key was always displayed in the URL):
    1. Create a page, name it Marketing-news (page name and friendly URL will be Marketing-news)
    2. Add a German translation, name it German, and save without adding the friendly URL
    3. Open the page with a user with English language set -> we had the http://localhost:8080/en/marketing-news URL
    4. Then switch to German either by setting it in the user's account settings or just changing the language key from en to de in the URL -> http://localhost:8080/de/marketing-news
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助