Managing Internationalization and Multiple Languages - Magento Search Engine Optimization (2014)

Magento Search Engine Optimization (2014)

Chapter 3. Managing Internationalization and Multiple Languages

Magento provides us with the ability to target specific countries using its own inbuilt store management system. When a website is live on the Internet, it is accessible from almost anywhere; therefore, it is important that our website is easily findable around the world. To do this, we must be able to rank well in the search engines that reside in each of the countries we are targeting.

While preparing our website, we must be mindful of the fact that many of our category, product, and CMS pages will be duplicated across URLs. Therefore, we must learn how to make the search engines aware that we are providing these pages in multiple languages and also how to provide them with all the relevant information so that our rankings do not suffer as a result of these duplications.

In this chapter, we will be learning how to do the following:

· Choose the best URL structure to suit our multilanguage setup, understand the positives and negatives of each configuration with respect to SEO, and how to implement a subdirectory-based store structure

· Change our page titles, descriptions, and content for each store view and understand the limitations of global scope attributes

· Indicate to search engines that the content we are serving is intended for a specific language and avoid duplicate content penalties

Choosing the right domain structure for multiregional websites

When it comes to optimizing a website that targets different countries and languages, the most important rule to follow is that each translation of a page must have its own unique URL. This is to allow search engines to easily distinguish our translated pages and also to let our visitors know that they are viewing the website with a particular locale. As Magento allows us to change the base URL for each of our stores, changing the URL becomes relatively easy to execute. The only consideration would be the format in which we should be configuring our URLs.

Depending on our website setup, the general consensus is to set our base URLs to match one of the following formats:

· ccTLD (country code Top-Level-Domain):

· Example: www.mydomain.fr

· Positives: Geo-targeting performed by the TLD, and easy to distinguish for customers

· Negatives: It is difficult to manage multiple domain names and some ccTLDs are hard to acquire, have limited availability, and can be expensive

· Subdomains with gTLDs (generic Top-Level-Domains):

· Example: fr.mydomain.com

· Positives: Geo-targetting can be performed by using Webmaster Tools and is relatively easy to set up

· Negatives: Here, geo-targeting for customers may not be clearly evident and could conflict with other subdomains in-use on the domain (for example, m.mydomain.com)

· Subdirectories with gTLDs:

· Example: www.mydomain.com/fr/

· Positives: Geo-targetting can be performed by using Webmaster Tools, is easy to set up, and minimal cost is involved

· Negatives: Here, geo-targeting for customers may not be clearly evident

Note

For more information on optimizing the domain structure for multiregional websites, please visit the following URL (google.com):goo.gl/MB9zm0.

Depending on our website strategy, any one of these implementations could suit our needs; however, if simplicity is the main goal, I would personally recommend using subdirectories with a gTLD.

The subdirectory method will allow us to use the same administration panel without the need to perform any complicated server adjustments, such as changing our vhosts configuration. Also, by using geo-targeting within Google Webmaster Tools, we are providing Google with the same level of information that ccTLDs provide automatically.

The following steps assume that a multistore configuration has already been set up within our Magento installation. For more information on setting up multistore Magento websites, please see the following link (magentocommerce.com): http://goo.gl/iYNKO8.

In order to set up our subdirectory structure, we simply have to perform the following steps:

1. Create a new folder in our root to match our chosen language (for example, /fr/) and copy our Magento index.php and .htaccess files into it from the Magento installation root.

Tip

On some operating systems (such as Mac OS X), .htaccess files might be hidden from view until the directory is opened in a web authoring application (such as Adobe Dreamweaver) or the "show hidden files" setting has been enabled.

2. Within the copied .htaccess file, we can specify our store code by entering the following code at the bottom of the file:

SetEnv MAGE_RUN_CODE fr

Tip

To find our store code (in this case, fr), we can navigate to System | Manage Stores, click on Store View Name for our chosen store (for example, French), and look in the box labeled Code.

3. Within the copied index.php file, we must make sure that our paths are correct (mentioned in the previous directory) by changing the following highlighted code:

4. $compilerConfig = MAGENTO_ROOT . '/../includes/config.php';

5. // and

$mageFilename = MAGENTO_ROOT . '/../app/Mage.php';

6. Within System | Configuration, we can dive into our store view customization by clicking on our store view (for example, French) from the Current Configuration Scope dropdown.

7. We can then set our store-specific configuration under Web | Unsecure and Web | Secure by unchecking the Use Website checkbox next to each of the textboxes, as shown in the following screenshot:

Choosing the right domain structure for multiregional websites

8. Within Base URL, we should enter our full URL path including our /fr/ subdomain, and for Base Skin URL, Base Media URL, and Base JavaScript URL, we should add ../ to our path in order to fetch the files from outside our /fr/ directory (for example,{{unsecure_base_url}}../js/).

9. We can then click on Save Config and navigate to our new store in the new subdirectory, for example, www.mydomain.com/fr/.

Then, in order to set up geo-targeting for our new subdirectory, we can simply perform the following steps:

1. Log in to Google Webmaster Tools (http://www.google.com/webmasters) and click on Add a site; enter our new URL including the subdirectory, as shown in the following screenshot:

Choosing the right domain structure for multiregional websites

2. After verifying the domain, we can click on this site and then on the settings button (top right); here, click on Site Settings. At the top, we can specify Geographic Target.

Choosing the right domain structure for multiregional websites

Store-specific configuration

"Google only uses the visible content of your page to determine its language."

--Google

It is important to make sure that we translate as much as possible when providing users with translated versions of our product, category, and CMS pages. We can translate manually entered text by manipulating the values on a per-store scope configuration level within the administration panel as follows:

· For categories, we should navigate to System | Manage Categories and select our store from the Choose Store View dropdown (as shown in the following screenshot). We should then translate our values for Name, Description, Page Title, and Meta Description.

Store-specific configuration

· For products, we should navigate to System | Manage Products, click on our product, and then select our store from the Choose Store View dropdown. We should then change our Name, Description, Short Description, and Meta Information values where appropriate.

· For pages, we would need to create additional CMS pages and then select the appropriate store view within Page Information | Store View. We can then enter our translated Content, Meta Information, Page Title, and even URL Key values.

Translating URL keys

URL keys for products can be changed on a per-store basis so long as we change the Scope of the attribute to Store View rather than Global. To do this, we would need to navigate to Catalog | Attributes | Manage Attributes, click on the url_key attribute, and change the Scope to Store View, as shown in the following screenshot:

Translating URL keys

Note

Unfortunately, by default, Magento does not allow category URLs to be configured per-store scope, which is a definite problem when we want to translate them into different languages.

Hopefully, newer versions of Magento will feature store-scope category URL keys. For now there is a hack, but please be aware that it is a hack and use it only on your development environment until you are sure there are no adverse effects. To find the hack, please visit the following URL: goo.gl/YPrmyJ

Translating template content

There are a few methods to translate the text that is embedded within the template files (text that we cannot edit via the administration panel, for example, the Add to Cart button label, and so on). The most popular is to install a language pack or locale. To do this, we would perform the following steps:

1. Visit www.magentocommerce.com/translations, download the relevant language pack, and install the files in the applicable directories.

2. Within System | Configuration | General, set Locale to our downloaded language, making sure our Current Configuration Scope is set to the store we wish to apply the translations on.

Tip

We can also translate text through our own theme locale folders using a file called translate.csv. For more information on how to do this, please visit the following link (tomrobertshaw.net): goo.gl/zD5ECW.

As Google and other search engines pick up on a variety of elements on the page, it's important to try to translate as many configuration options as possible. Here are a few important areas to consider:

· Default store information (System | Configuration | General | Store Information), especially address and phone number if available

· Product attribute values/labels (Catalog | Attributes | Manage Attributes); these can be edited per store as long as the Scope is set to Store View

· For translations not covered by the language pack, we can use the Translate Inline tool (System | Configuration | Developer | Translate Inline) and set Enabled for Frontend to Yes

Note

For a complete tutorial on using Translate Inline, please see the following link (inchoo.net): goo.gl/VaQkY0.

Tip

It is extremely important that, when adding translations to our websites, we hire a translator who is native to that particular country. The copy must then be optimized for SEO, just as it would when writing it ourselves.

We must pay particularly close attention to the translation of our keywords. These are our most important phrases and must be translated correctly for the appropriate search engine and audience.

Avoiding duplicate content when translating pages

While translating our Magento store, we can never be too careful when it comes to duplicate content. Essentially, what we are doing is duplicating our Magento installation and then translating the same pages into different languages.

In order to specifically inform search engines such as Google and Yandex of the locations of our translated pages, we should use the rel="alternate" hreflang="x" tag.

This tag lets search engines know the exact location and intended audience of our translated pages. There are two implementations of this tag; one is with meta information stored in the <head> tag per page and the other is through the XML sitemap.

The correct method for using the rel="alternate" hreflang="x" tag is to include a copy of it within our <head> area for each and every translated version of our page. The following is an example of that:

<-- default to our primary website language version of this pageusing x-default -->

<link rel="alternate" hreflang="x-default" href="http://www.mydomain.com/my-product.html" />

<link rel="alternate" hreflang="fr" href="http://www.mydomain.com/fr/my-product.html" />

Here, hreflang can either be a standard ISO 639-1 code (language classification) or alternatively appended with an ISO 3166-1 alpha-2 code (country code). In fact, we could let search engines know about a page that targets a language in a specific country, for example, fr-ca for French-speaking Canadians.

Tip

In this instance, it would be appropriate to name our folder structure in the same way so that we can create a specific store view for French speaking Canadians—for example, /fr-ca/—so that we can set the correct currency, and so on.

For a detailed list of possible ISO-format country codes, please see the following URL (iso.org): goo.gl/5HPp5g.

The XML sitemap method, however, is the preferred way of informing search engines about multiple languages on our website, and a good example of this can be found on the store.apple.com website. We can see that they cater to many countries (also using the subdirectory method) within their own XML sitemap:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">

<url>

<loc>http://store.apple.com/us/browse/home/shop_mac</loc>

<xhtml:link rel="alternate" hreflang="en-us" href= "http://store.apple.com/us/browse/home/shop_mac" />

<xhtml:link rel="alternate" hreflang="en-ae" href= "http://store.apple.com/ae/browse/home/shop_mac" />

<!—- another 40 combinations for this url not shown -->

At this moment, it is unclear as to whether there is a Magento extension available that will provide us with either the <head> implementation or the XML sitemap version in the correct format, and doing this manually could take a very long time (depending on the complexity of our website).

For now, we can implement a standard set of tags within our Magento website that (although not perfect) will provide search engines with at least a modicum of knowledge about the available translations on our website. To do this, we should add our tags by navigating to System | Configuration | Design | HTML Head | Miscellaneous Scripts (simply the base URLs), as shown in the following screenshot:

Avoiding duplicate content when translating pages

Tip

For more information on what the rel="alternate" hreflang="x" tag can do, please see the following link (google.com): goo.gl/Bk47LE.

Summary

In this chapter, we have learned about the different ways in which we can structure the domains/URLs of our different store views in order to cater to different languages as well as looked at an example of how to set up the subdirectory method. From this, we have seen how we can change our configuration scope to adjust certain elements on our pages, such as titles, descriptions, and (some) URL keys.

We've installed a language pack on our French store view and also looked at other important areas/methods for translations.

We now understand the importance of the rel="alternate" hreflang="x" tag within our Magento store and can implement a short-term fix (unless a lot of hard work is achieved through XML sitemap generation or manual addition into the template) until an extension or update within Magento enables this feature dynamically for us.

Now that our multilanguage store has been set up correctly, in Chapter 4, Template/Design Adjustments for SEO and CRO, we can begin to look at modifying our Magento template files for products and categories in order to better optimize their content for both search engines and customers.