Canonical link tag

askibinski - February 13, 2009 - 15:33
Project:Global Redirect
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

The canonical link tag is now available to avoid duplicate content.

There is an unofficial patched version released which you can find here.

I took this patched version out for a spin to test it out. Think it would be nice to implement this in a future release? You should be able to assign one alias as the preferred url though (in case of multiple aliasses to 1 node).

#1

nicholasThompson - February 13, 2009 - 16:00

It's going to be in a future release and I've been speaking with Sotak himself about this :)

We're Already On it :)

#2

Rob Loach - February 13, 2009 - 18:43

More information about canonical links is available from the Google Webmaster Central Blog: Specify your canonical.

I'm not sure how I feel about the unofficial patched version. It cancels the 301 redirect, and just sticks in the canonical link instead. Shouldn't it do both?

#3

nicholasThompson - February 13, 2009 - 18:56

Couldn't agree more. 301's to tidy up the stuff like excess slashes or system URL when aliased exists... And then canonical on the page which clarifies whether or not things like query string should be taken into account.

One issue we will need to look into is pages with pagers on them.. Especially panels with multiple pagers!!

#4

Rob Loach - February 13, 2009 - 19:44
Status:active» needs review
AttachmentSize
canonical.patch 1.85 KB

#5

no2e - February 15, 2009 - 22:28

subscribed

#6

OnkelTem - February 16, 2009 - 20:20

Please please please... patch for 5.x :)

#7

JStarcher - February 18, 2009 - 05:42

Rob, what are those patches?

#9

Dave Reid - February 18, 2009 - 15:52

Interesting new feature. Subscribing!

#10

nicholasThompson - February 18, 2009 - 17:16

RobLoach - in your patch in #4, what happens if you're on (for example) a paged taxonomy term page? so you'd have somthing like:
http://example.com/taxonomy/term/123
http://example.com/taxonomy/term/123?page=1

Does the url() function also pick-up the arguments? What about other irrelevant arguments... eg...
http://example.com/taxonomy/term/123?page=1&flibble=blooblah

How do we know "flibble" is irrelevant? Is it?

Also.... multilingual sites... Does it work in this situation?

#11

rickvug - February 18, 2009 - 17:48

Subscribing. Also, wanted to note that this patch got a shout out in our blog at http://imagexmedia.com/blog/2009/2/what-canonical-url-module-drupal-help....

#12

askibinski - February 19, 2009 - 13:41

@#10
the unofficial patch doesn't work in multilingual sites. Maybe the patch in #4 does, but I haven't tested that one.

@#2
No it shouldn't do both. Canonical is simply another way to tell search engines about duplicate content. And there could be circumstances where you would want to have two pages with the same content but slightly different header for example.

#13

gthing - February 19, 2009 - 16:45
Version:6.x-1.x-dev» 5.x-1.x-dev

Second for 5.x version!

#14

bejam - February 25, 2009 - 16:09

subscribing

#15

jwuk - March 2, 2009 - 13:10

Interesting. Sub'ing. Thanks for acting on this so quickly.

#16

open-keywords - March 2, 2009 - 14:33

I would suggest a strategy:
When we clearly know which URL is the canonical URL for the given request, we insert the tag in the HEAD with the proper canonical URL. Fine

When we are not sure of the very best canonical URL, we do NOT insert this LINK REL tag in the HEAD, and let the crawler do as it used to deal with these until now : trying to figure it out by himslef.

This way we don't take the risk of misleading the crawler, but for every URL without a risk, we can already help the crawler.

What do you think ?

Thanks for your attention

#17

open-keywords - March 2, 2009 - 14:32

some further details about when and how to use this recommendation (google crawling official blog)

http://googlewebmastercentral.blogspot.com/2009/02/canonical-link-elemen...

#18

open-keywords - March 2, 2009 - 14:36

We should take care of using the exact same URL for a node as in the one being used in the XML / Google sitemap module.
It is key that the 2 systems recommend the same URL for the same content/object/node.

#19

open-keywords - March 3, 2009 - 06:56

See http://drupal.org/node/389380 for tracking consistency issues with XMLSITEMAP

#20

natrio - March 24, 2009 - 16:48

Subscribing...any new updates on the patch?

#21

fiLi - April 16, 2009 - 09:44

Subscribing. Interested in this.

#22

dkruglyak - June 6, 2009 - 22:24
Version:5.x-1.x-dev» 6.x-1.x-dev

I think the patch could be committed even in the current form. Given that writing out a canonical tag is merely an option it would do not harm.

FYI, a similar feature has been commited to Meta Tags module: http://drupal.org/node/374049

We should consider if there is any conflict / problem setting the tag in two places.

#23

sedmi - June 11, 2009 - 13:46

Is there valid patch for drupal 6?

I applied patch #4 and it didn't add field where canonical url can be added. It takes url specified under url alias and places it in meta canonical. So the result is (if you use global redirect for url aliases) you have page specifying its own url as canonical.

#24

EvanDonovan - August 24, 2009 - 17:12

Subscribing. I tested the patch in #4 and it is working great for me. I think this could be committed to the module "as is". It works for stripping off query strings, etc., but it wouldn't work for the use cases that the Canonical module or the Nodewords feature cover (where you specify the canonical tag on a page-by-page basis).

That's fine with me though. I don't need or want that kind of granular control. If I wanted it at all, I'd like it as an override, having an interface similar to URL aliases or URL redirects module. But that should be a follow up patch, I think, after this gets committed.

#25

Rob Loach - August 24, 2009 - 17:42
Status:needs review» by design

Let's move this discussion over to the issue queue in http://drupal.org/project/canonical_url and improve that instead of having druplication going on here.

#26

EvanDonovan - August 24, 2009 - 18:08
Status:by design» active

That sounds good. But does that module insert the tag automatically, or do you have to add it for each node?

(Feel free to set back to "by design" later. I just wanted to make sure this reply would show up in people's issue tracker first.)

 
 

Drupal is a registered trademark of Dries Buytaert.