Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
If there are no alias created by pathauto globalredirect works fine. However, if there are aliases created by pathauto then globalredirect creates bad canonical with duplicated language argument.
The correct canonical would be something like this:
link href="http://www.example.com/pt-br/node_title" rel="canonical"
The bad canonicals has duplicated language argument (/pt-br/pt-br/):
link href="http://www.example.com/pt-br/pt-br/node_title" rel="canonical"
I tested on pathauto-7.x-1.0-rc2
Comment | File | Size | Author |
---|---|---|---|
#14 | 1205982-14-remove-canonical.patch | 1.22 KB | moymilo |
| |||
#9 | canonical-twice-time.png | 57.32 KB | RavindraSingh |
#3 | 1205982-globalredirect-duplicate-canonical-prefix.patch | 585 bytes | mrfelton |
Comments
Comment #1
Mac_Weber CreditAttribution: Mac_Weber commentedchanging to major because of SEO problems this issue can bring
Comment #2
Mac_Weber CreditAttribution: Mac_Weber commentedI changed line 241 from:
to:
Canonicals look good now, yet this is far from the best solution. I'm not sure if the problem is on
$prefix
or'prefix'
on the options array ofurl()
Comment #3
mrfelton CreditAttribution: mrfelton commentedAttached patch basically does what was suggested in #2, which seems to work. (This patch is for D6)
Comment #4
mrfelton CreditAttribution: mrfelton commentedComment #5
Mac_Weber CreditAttribution: Mac_Weber commentedmrfelton, this does not really fix the problem.
It just make masquerades the problem. Again, it should be fixed on
$prefix
or'prefix'
(I don't know exactly which one).Comment #6
mrfelton CreditAttribution: mrfelton commentedYes Mac, please see #1208144: in case of fallback language canonical should point to original language. This issue is tied up with that one, and there is a more complete patch in that ticket.
Comment #7
marcoka CreditAttribution: marcoka commentedi can 100% confirm the issue i get the language prefix twice to, like de/de or en/en
It also seems that the metatags module already adds one correctly
...
...Comment #9
RavindraSingh CreditAttribution: RavindraSingh commentedDrupal core provides default canonical URLs for nodes pages, If you have enabled the global redirect for multilingual site you would see this error definitely, even you would see canonical is placed twice in node page.
And I think everysite needs it for SEO. where site owner definitely add meta tags module.
So this would be the good idea to remove canonical code from global redirect module. So I have created a patch for that.
Comment #10
RavindraSingh CreditAttribution: RavindraSingh commentedComment #14
moymilo CreditAttribution: moymilo as a volunteer and at Drupal Ukraine Community commentedRe-apply patch on the new code base.
Comment #15
moymilo CreditAttribution: moymilo as a volunteer and at Drupal Ukraine Community commented