Reusing backbone views/routes on the server when using Backbone.js pushstate for seo/bookmarking

余生颓废 提交于 2019-11-28 23:48:49

I haven't tried this yet but these ideas using node.js and backbone might help:

http://andyet.net/blog/2011/feb/15/re-using-backbonejs-models-on-the-server-with-node/

http://bennolan.com/2010/08/13/pushstate-and-nodejs.html

Basically the only way to make it so your not writing the same thing twice is to have both your node.js server and frontend client share the same routing/model code. If you are using something else on the server side (like Ruby) you would have to place node.js in front of your app server. Then make node.js proxy for new clients (push state and client js) and do actually rendering work for old/bot clients.

The other option is doing what jQuery Mobile does which is the Hijax method. The idea to make tons of HTML5 pages (you'll have to look at its routing to see).

And for completeness you should be aware of how google crawls AJAX: http://code.google.com/web/ajaxcrawling/docs/getting-started.html

This project does exactly what you are trying to do. It might interest you to check it out. https://github.com/developmentseed/bones

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!