I was checking out the new bits for durandalJS version 2.0 and found out that is now easier to make your Single Page Application be AJAX crawlable, for SEO purposes. Historically, crawling ajax pages were difficult to implement. Google created some specification so that you will have a way to render your “pages” when google bot crawls your pages.
I edited shell.js such that the routing looks like this:
Note the bang (!) character – this was the key. Of course, we wouldn’t want the navigation title to look ugly, so I had explicitly set the title property.
The somepage.js viewmodel doesn’t change – for example:
The address bar looks like this – nice! It now follows the specification by Google.
Depending on your backend technology, you will have to create a special “renderer” which spits out the “near equivalent” content of your page when google bot crawls your pages by detecting the _escaped_fragment_ query parameter. Per specification, “the search engine agrees to display in the search results the corresponding pretty URLS”, so that when your “page” link gets clicked, the browser goes to the “single application page” with the proper query parameters.