Different document url for each culture

Ayoub Ag. asked on January 21, 2016 16:56

Hi,

I have an issue with live urls. in kentico 9 with hotfix 9.0.5. i'm using a site with two cultures en-CA and fr-CA.

The issue is that i don't find a way to create a different live url in french culture different from the English one.

steps to create a new document:

  1. in en-ca site i create a new page with the name Deals so the live url is /en-CA/Deals

  2. i did a copy from English to create the french page but i got the same live url /fr-CA/Deals even if i change the document name to Offres.

what i expect is to have those live url /en-CA/Deals and /fr-CA/Offres.

is there any settings to set to have different url in each culture for the same document?

NB.: due to the SEO i don't want to use alias.

Thank you

Recent Answers


David te Kloese answered on January 21, 2016 17:00

Hi,

To enable language prefixes, go to Settings -> URLs and SEO, and enable the Use language prefix for URLs setting.

For more info see: https://docs.kentico.com/display/K9/Configuring+URLs+for+multilingual+websites#ConfiguringURLsformultilingualwebsites-Enforcingseparatedomainsforlanguages

Greets,,

David

1 votesVote for this answer Mark as a Correct answer

Laura Frese answered on January 21, 2016 17:34 (last edited on January 21, 2016 17:37)

To change the URL go to Pages > Properties > For Page URL path add a different path for each culture version. An example of how this is done is included on the page David linked to under the section "Using a custom document URL path for different culture versions"

0 votesVote for this answer Mark as a Correct answer

Ayoub Ag. answered on January 21, 2016 19:56

Thank you for your help.

my other question: is there any macro which can help me to set the Path or Patern automatically i used this but it doesn't work

Code /{% currentCulture %}/{% DocumentName %}

any suggestion

Merci

0 votesVote for this answer Mark as a Correct answer

Laura Frese answered on January 21, 2016 22:58

I don't think you can use macros for the URL path or pattern. If you scroll down to "Using language prefixes for URLs" in the link that David provided, it describes how to ensure there is a prefix.

If you do not own a different domain name for each language version of the website, but still want to ensure unique URLs for each culture without adding query string parameters, you can use language prefixes. Language prefixes insert a subdirectory into the URL in format <domain>/<language prefix>/<URL path>, for example: <domain>/fr-FR/Home
To enable language prefixes, go to Settings -> URLs and SEO, and enable the Use language prefix for URLs setting.

Note: You cannot use language prefixes if the Force domain culture setting is enabled.

You can also change the prefix text:

Changing the language prefix text:
By default, the language prefix matches the culture code of the requested language. If a culture alias is set for the language, it takes precedence and the system uses the alias instead of the culture code. If you want to change the language prefix for a certain language, the best way is to set a culture alias.

For example, to change the language prefix for the French language to France:
Open the Localization application.
Select the Cultures tab.
Type fr-fr into the Culture code filter and click Search.
Edit the French - France culture.
Set the Culture alias property to France.
Click Save.

The system now displays the language prefix in URLs of French page as for example:

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on January 21, 2016 23:06 (last edited on January 21, 2016 23:08)

Hi,

If you enable the setting I mentioned the culture part of the url will work automatically.

I don't believe the path can be updated automatically. At the moment you create the page it has no Documentname yet. So a default macro wouldn't work...

However you could expose the default 'System' field into the form tab. This could make the 'DocumentUrlPath' (or any other) visible inside the form tab. This way the editor can set the page url while filling out the form.

  • create a new field
  • select Page field
  • Select the page fields group
  • select the DocumentUrlPath
  • enable it for display and perhaps add a custom caption

http://content.screencast.com/users/DavidTK/folders/Jing/media/5927d449-2181-4bc2-b8e8-b19bd629a7d7/2016-01-21_2302.png

This could however give the editor to much freedom, and not everybody will understand it.

An other option would be to create an custom object event and after a page is created you set the url path from your custom code.

You can find more info here: https://docs.kentico.com/display/K9/Handling+object+events

David

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.