1

I have a multilingual site based on drupal 7 with Internationalization i18n and Metatags modules. I made a multilingual view and it works fine, I could translate all entities except the view-description (and of course the metatag description). I would like to have for each language a different meta tag description of the view.

As I can read in this issue, it seems there is still no solution.

Is there any workaround? Thank you for replying.

1

You could add something in the html.tpl.php along these lines:

  <?php
  if((function_exists('views_get_page_view') && views_get_page_view()) && ($language->language == 'fr')){ ?>
      ...Your metatag here...
  <?php  
  }elseif((function_exists('views_get_page_view') && views_get_page_view()) && ($language->language == 'de')){ ?>
      ...Your metatag here...  
  <?php } ?>

views_get_page_view() finds out what, if any, page view is currently in use. If it returns NULL, then the current page is not a views' page.

Source

This line of code may come in handy as well, to figure out which view:

$view = views_get_page_view();

Source

Is this enough to help you on the way?

  • It could be a solution,but I would prefer not to edit the tpl files. Moreover adding the meta tags in this way, would duplicate the meta tags that are already set by the module (I think I should disable the submodule Metatag-Views, in order to avoid duplicates). Anyway I'll try your code. Thanks. – gingo Jun 3 '15 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.