Using new languages with SEO-friendly URLs
The default token for the language usage is LanguageToken
. Because the
keywords for the language token are taken from the language registry, you do not have to define
them.
By default LanguageTokens
are taken from the language registry. The
lang
code is the keyword. For example, in English, the urlKeyword
is en
and languageId
is -1
.
But this default behavior can be overridden by defining separate urlKeywords
(other than the default language code) for any language, in SEO URL Pattern files.
<!-- Override keywords for language tokens. By default language tokens will be read from Language registry.
Ex: for langId = -1, the language token will be 'en'. Use the below node to override the default keywords -->
<seourl:languageKeywordDef>
<seourl:LanguageKeyword languageId="-7" urlKeyword="zh-CN"/>
<seourl:LanguageKeyword languageId="-8" urlKeyword="zh-TW"/>
</seourl:languageKeywordDef>
The language code for Simplified Chinese and Traditional Chinese is zh
. To
override the language code define URL keywords in SEOURLPattern files.
To configure multiple languages to work with SEO when the same languages are being used for
different countries, the language ID must be explicitly defined in
SEOURLPattern.xml. If the ID is not defined, incorrect property files can be
loaded as the language ID conflicts. A typical example would be a Canadian site that supports both
English in Canada and US. For example, to support en-US, en-CA and French you must define the
following languages in
SEOURLPattern.xml:
<seourl:languageKeywordDef>
<seourl:LanguageKeyword languageId="-1" urlKeyword="en-US"/>
<seourl:LanguageKeyword languageId="-24" urlKeyword="en-CA"/>
<seourl:LanguageKeyword languageId="-25" urlKeyword="fr"/>
</seourl:languageKeywordDef>
Note: Alternatively,
you can place the SEOURLPattern.xml into files within the eSite Store
directories rather than at the AssetStore. One store defines en_CA while the other store defines
en_US.