SEO for multilingual Drupal sites


SEO is important for most Drupal sites. It also needs to be multilingual.

The Nodewords module allows you to add meta data to your content. The Translation Management module already handles translating meta data that is added to each node.

Nodewords also allows you to add custom meta data to your pages. For example you can add custom meta data to all you blog entries without having to add it to every page. Translating this data is a little more tricky.

The Nodewords module implements hook_preprocess_page() to add its meta data to a page. In this process it uses the drupal_alter function to allow the variables to be altered. This looks like a perfect spot to insert any translations.

How do we enter the translations?

The t() function can be used to translate interface strings. Any strings passed to the t function will be added to the locale tables and the translations can be entered via the Translate interface, /admin/build/translate. This looks ideal for us. The problem is, this is not what the t() function is designed for. It's meant to be used to translate fixed strings from php code. eg t("Read mode...")

You can read more about the use and miss-use of t() in Gábor Hojts' article.

The other option is to use the i18nstrings functions. This is designed to be used for this sort of purpose. The problem here is that we need a unique identifier that we can use to save the string. In this case we don't have that, we only have the string text itself.

Any ideas?

We're looking for creative ideas on how we can use i18nstrings, drupal_alter and Nodewords together.

What do you think?


Is there any way to Drupal

Is there any way to Drupal remember chosen language for anonymous users? I mean, user picks language and next time he get redirected to previously chosen language homepage? Edoardo has pointed me with his post to where I should look for solution. I guess that it should be like this: user choose languege and set cookie, on next visit check for cookie and if it's set redirect to homepage in selected language. How to do that in Drupal? I have found some php code about cookie redirection but it's not Drupal specific. Does anybody have solution for this?

Nodewords translate module?


I know on Nodewords Translate module page, there is a issue which is about this, see:

Greetings, Martijn

One way is to suggest a patch

One way is to suggest a patch to nodewords to pass along some more meaningful info in addition to the string.

Presumably it has to first figure out what type of page it is (node, view, panel, etc.), then load the object, then build the string. Perhaps it should send along (string)$object_type and (object)$object or at least (int)$object_id.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options