0

Lately, I read a lot about hash-bang urls versus history.pushState to build SEO-friendly AJAX-Sites. It seems that everyone agrees that pushState is the better approach so I want to use it.

Here is the problem: I have a Single-Page Website and (on the Server) a database with around three million entries – I do not have static pages for all these entries but fetch them with AJAX and insert them in the site (if a user clicks a certain link or performs a search).

With HashBang-URLs I know that the Spider will look for a different URL (escaped_fragment…) so on the server-side I can serve an 'ugly' page that contains no styles but only the content i want to be indexed.

Users can bookmark the URLs and get pretty content because the URLs are different (#!…) and Javascript will generate the content.

With history.pushState on the other hand, I will be forced to use URLs like '…getItem.php?itemid=356375' (right?) – but now, I can no longer serve ugly content here, because users might bookmark these URLs.

So, in a nutshell:

Hash-Bang allows us to focus on client-side pretty content-rendering via javascript while serving 'ugly' content-only pages to search engines – PushState forces us to serve pretty content all the time without using javascript?

Is there any workaround for that? Any way to not have to serve pretty content on the server-side (in my case PHP) while still making it possible for users to bookmark URLs that serve pretty content (via Javascript)?

Fluchtpunkt
  • 447
  • 5
  • 11
  • I don't think you get the pushState method. Imagine having lovely URLs for each sub page like you get with #!, but without the #!. Instead of needing to support the separate ugly URL you should directly support the friendly ones so they generate the correct and bot readable content (You can do that if no # is involved). Then pushState lets you update the bookmarkable address bar as the user switches subpages via your AJAX. – Tony McCreath Jun 18 '14 at 03:16
  • Hello Tiggerito, actually I already used pushState like that. For loading content of existent pages faster – including back-button-functionality etc. That works fine - and of course google indexes these sites. But the real problem comes for all the content we don't have pages for but render it via Javascript and want google to index…and sadly can't provide an alternative 'escaped_fragement…'-SEO-only-link for like when using #!. The more I read about it the more I get convinced that pushState can't replace #! in this aspect but for most people it just doesn't matter. – Fluchtpunkt Jun 19 '14 at 10:10

1 Answers1

0

I have been working with this problem for a couple of months and came to the conclusion that you have to be able to support #! paths in your site if you want Google to do the _escaped_fragment_ crawling.

I found that Google would simply not _escaped_fragment_ a # or standard path in a suitable manner.

I have a much more details write up on my blog site.

http://mark.stratmann.me/articles/the-great-ajax-seo-saga

Mark Stratmann
  • 1,612
  • 14
  • 21