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.)

  • 16
    ...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! :) Commented Jul 16, 2009 at 17:16

3 Answers 3


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.

  • 2
    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'>.
    – cregox
    Commented Mar 12, 2010 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.

  • Is that even meaningful? I guess not, judging by Jeff's edit on his own post. Commented Jul 16, 2009 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.

  • 3
    We share those links all the time.
    – user206222
    Commented Oct 9, 2013 at 14:22

You must log in to answer this question.

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