What is meta? ×

Google now supports <link rel="canonical">, which allow a page to point to the canonical version of itself. This would help to fix a problem with Stack Overflow's Google search results, in that questions appear multiple times for no good reason.

For example, the result page for:

  • "How to find header dependencies for large scale projects on linux"

shows the question three times under different URLs, starting with the canonical one but then also including the superfluous:

If each page had in its <head> section a <link rel="canonical"> pointing to the canonical page, that shouldn't happen any more.

(Meta meta: Try as I might I can't get links to work. Apologies for the lack of links in this question.)

share|improve this question
...on the other hand, having three links on the first page of search results crowds out two other links from the front page of Google. Muahahahahaha! :) –  Bill the Lizard Jul 16 '09 at 17:16
Good idea, and +1 for making me aware of rel="canonical"! –  Kip Jul 16 '09 at 17:49

3 Answers 3

up vote 7 down vote accepted

We already do this.

<div id="question-header">
    <a href="/questions/6193/suggestion-use-relcanonical-to-improve-stack-overflows-google-results" 
        class="question-hyperlink" rel="canonical">
    Suggestion: Use rel=&rdquo;canonical&rdquo; to improve Stack Overflow&rsquo;s Google results

Notice "rel canonical".

edit: oh, I see. I think I misunderstood what Google wanted here (eg, one link in header versus a "nofollow" style attrib that goes on the all the hyperlinks you want to make canonical). Making the change.

share|improve this answer
Confirmed fixed - thanks! –  RichieHindle Jul 17 '09 at 8:04
This answer alone is a bit confusing. May be worth mentioning the actual fix is removing the rel='canonical' from the <a href> and using it as proposed on the question like <link rel='canonical'>. –  Cawas Mar 12 '10 at 18:48

Huh, I thought they did already, but it looks like they're only putting rel="canonical" in links to other pages on the site.

share|improve this answer
Is that even meaningful? I guess not, judging by Jeff's edit on his own post. –  RichieHindle Jul 16 '09 at 19:17

IMO, rel="canonical" is just a work-around. A perfect solution to resolve the problem would be to hide parameters like sort=newest in POST request.

A drawback is a lack of permalink. But does anyone share the links like active, oldest or votes? I don't think so - there is already a way to share a question or a single answer and this is enough.

After the change, URLs with any ?queryParams should 301 Permanent Redirect to their canonical version without any query string parameters. This will make Google forget the old URLs almost immediately.

Currently, 3 years after link[rel=canonical] was implemented, Google knows about these URLs. robots.txt correctly say not to index them but still - Google keeps na eye on it and will include them in the search results if needed. The description will just be empty.

The most clean approach is to provide a permalink to what you want shared by people and indexed by robots, and a dynamic link to what you don't want to.

share|improve this answer
We share those links all the time. –  Emrakul Oct 9 '13 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .