15

Lately, I've seen many search results in the form of https://stackoverflow.com/q/<id> and /a/<id> on Google. Why do I see these slug-less permalinks instead of the full URL?

For instance, a search for "google search max url length" gives https://stackoverflow.com/a/41718 instead of https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers:

google search result

For the record, it seems that Google has indexed 1.7M slugless questions and 3.2M slugless answers.

17

It was a simple mistake. The code that renders the head tags was refactored to support Twitter cards, that need the open graph equivalent of <link rel="canonical"/>.

The code to set the canonical URL was there, but in the wrong rendering section, so when the link was rendered, no value was yet present and nothing got written.

I've fixed it and it's now in the right place. Of course, it will take a little time for Google to catch up.

  • I still don't see <link rel="canonical"> in the source of (M)SO. Did you already publish the fix? – Rob W Oct 20 '13 at 14:45
  • No. that has not happened yet. – Sklivvz Oct 20 '13 at 14:46
  • @RobW It's now on meta, I'm letting it bake for a few to make sure it's not breaking stuff. – Sklivvz Oct 20 '13 at 14:53
  • @Sklivvz thanks for the explanation; I looked for the answer a good deal but wasn't phrasing it the right way I guess... – Toby J Oct 23 '13 at 16:02
12

I noticed something that might explain this behavior.

Somewhere between September 15 this year (2013) and September 23, the dev team removed the Canonical link element that used to be on all questions pages.

How I figured this? Here is an archived version of a question from September 15 and the same question eight days later - view the source of both to see the <link rel="canonical" ...> gone.

As for why it was removed I fear only a dev can answer. Maybe a simple mistake, maybe on purpose.

  • Nice work, detective! – Aaron Bertrand Oct 23 '13 at 15:34
  • @AaronBertrand yeah, time traveling detective! ;-) – ShaWiz Oct 23 '13 at 17:56

You must log in to answer this question.

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