How Does Twitter Maintain High Google Search Rankings Using #! URLs?
, Wellesley, MAA friend asked how to maintain high search rankings of a bunch of URLs that use Google’s #! AJAX URL convention. He cited Twitter as an example of a website doing it well. It’s true that Twitter uses #! in its URLs, and that Twitter pages rank highly in Google’s search results, but I notice that the search result URLs omit #!. Here’s how I think Twitter implements #! to maintain high search rankings:
-
The pages that rank highly omit
#!:http://twitter.com/matthewlmcclurerather thanhttp://twitter.com/#!/matthewlmcclure -
http://twitter.com/matthewlmcclureis a static HTML snapshot rather than a real time feed. -
The HTML snapshot includes the following so that requesting it in a JavaScript enabled browser will redirect to the corresponding
#!URL that loads a real time feed:<script type="text/javascript"> //<![CDATA[ window.location.replace('/#!/matthewlmcclure'); //]]> </script> -
For every
#!URL, there is a corresponding?_escaped_fragment=URL like:https://twitter.com/?_escaped_fragment_=/matthewlmcclure -
The
?_escaped_fragment_=URL returns a 301 withLocation: https://twitter.com/matthewlmcclureto close the loop and present the HTML snapshot to Google.
The content that Google sees for a #!/foo URL is different from what it sees for #!/bar so Twitter avoids any duplicate content penalty.