i've read this article for ajax indexing
how can i do to read the state in a url like this with rails?
ex.
http://mysite.com/controller/action#!pid=1237604&id=10792开发者_如何转开发97234
the state is:
pid=1237604&id=1079297234
thanks
You need to do a couple of things here :
1. The browser would not send you the parameters that come after the # , so you would need a client side javascript that converts these "pretty urls" into normal urls like :
http://mysite.com/controller/action?pid=1237604&id=1079297234
There is a good jquery plugin available for this . Take a look at the samples that it implements for crawling .
2. Apart from this , you would also need the mechanism to be able to handle the "ugly urls" that the googlebot sends . You can implement a small rack middle ware that transforms these ugly and pretty urls into normal urls that your rails app understands . Thus keeping this ajax indexing logic away from your app .
in ruby/rails, you'd use the params hash
params["pid"]
精彩评论