14

I have seen many websites using slugs in their URL to boost SEO such as this:

http://example.com/article/1543/how-to-boost-seo/

I was thinking if I could do something like this instead:

http://example.com/article/1543#how-to-boost-seo

and specify it as the canonical URL. This article from Google says, "It's a hint that we honor strongly." Does that include the fragment identifier, or would it be discarded?

1 Answer 1

13

Fragment identifiers are traditionally used to identify a portion of document for client-side applications. As stated in the specification Google adopted:

Traditionally, hash fragments (that is, everything after # in the URL) have been used to indicate one portion of a static HTML document. ...hash fragments are not part of HTTP requests (and as a result they are not sent to the server)

Consequently as this covers, the Googlebot ignores hash fragments by default. Therefore for this URL:

http://example.com/article/1543#how-to-boost-seo

Googlebot should just look at the resource returned by the server: http://example.com/article/1543 while ignoring the hash fragment: how-to-boost-seo.

So essentially the resource for the above URL is the canonical URL after normalization (i.e., removing the fragment).

The purpose of using a slug is to identify a page as a human-readable keyword. Using a fragment confuses this purpose and obscures its readability:

/how-to-boost-seo is a lot more readable than: /1543#how-to-boost-seo

So in short, using a fragment as a slug would not seem beneficial to users or search engines.

4
  • 1
    Thanks for the info. I read the specification, but the wording just isn't quite clear. It is like trying to infer what Google will index based on a document meant for AJAX crawling. Readability can be improved by adding a / like this /1543#/how-to-boost-seo. Aug 29, 2013 at 8:26
  • Take a look the last section (number 6) of the third link in my answer here. Google ignore everything after the hash, regardless of a slash after it, because it needs to normalize URLs to prevent duplicate content. If you need to use a hash in a URL, you'll need to use a hash bang #! as covered in their specification.
    – dan
    Aug 29, 2013 at 8:45
  • 1
    I found this which suggest that Google do index hashes to provide "jump to" links within a search result. It is now clearer, at least to me, that hash fragment may not be used in the main result. Aug 30, 2013 at 9:08
  • Yep, that's for rich snippets. Most search engines are the same, otherwise one page with many anchors links on it would result in the same page being indexed multiple times, resulting in duplicate content.
    – dan
    Aug 30, 2013 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.