0

I have different domains in a site in Drupal 7, which is multidomain and multilanguage, using modules Domain Access and i18n. I have duplicate content in some URLs accross domains, and I want to avoid Google penalization by following the recommendations of using

<head><link rel="canonical" href="CANONICAL_SOURCE_URL" />

I will use a custom module. For the nature of Drupal 7, I undestand that I can check each node, and using the node->id and database call, to check the domains in which the node is active. Following an order of preferred domains, I will know that URL to set as the canonical.

Is that a good aproach? I have tried module MetaTag with Canonical, but it uses a wildcard approach so it repeats the domain in which I am, so we can have www.example.com/link1 and www.example.us/link1 as canonicals, when only one of them should be used.

How can I override MetaTag with my own link rel tag ?

2
  • 1
    Maybe it is better to use Metatag module? Apr 26, 2016 at 21:13
  • 1
    I added a clarification on my answer. Apr 28, 2016 at 11:43

1 Answer 1

1

It is better to use Metatag module which has ability to override meta tags on each entity objects. Other tokens must be used.

9
  • Please read the question about using MetaTag with Canonical, and the wildcard approach problem. If you know how to override it, I could do it directly with no need of my own module.
    – Cesar
    Apr 27, 2016 at 7:07
  • You downvoted my response but it is the right one. I've already done this on my two domains. In this case I suppose that it is better to use MetaTag module and yes, it is possible to use ONLY ONE DOMAIN for both ones in the automated way, you have to choose the right tokens Apr 28, 2016 at 11:44
  • Edit your answer and I will vote you positive. I will try your approach later.
    – Cesar
    Apr 28, 2016 at 14:14
  • I edited the answer. Apr 29, 2016 at 18:56
  • I have been unable to making your approach work. Perhaps due to a different configuration. I voted you up to compensate, my first action was not strange, I mentioned a module not working for me and you insisted on the same module. I rectified my first decision and apologize.
    – Cesar
    May 2, 2016 at 9:45

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.