首先,您需要知道
domain.com/#/about它将调用服务器的“
/”路由,因为它不读取#片段。您的服务器将呈现Backbone.js应用程序的基础,而Backbone将触发“关于”路线。
因此,您需要在Express JS中声明两条路由:
- /
- /关于
app.get('/', function(req, res) { // Trigger the routes 'domain.com' and 'domain.com/#/about' // Here render the base of your application});app.get('/about', function (req, res) { // Trigger the route 'domain.com/about' // Here use templates to generate the right view and render});
我建议您通过Derick Bailey与Backbone.js实现SEO兼容性的3个链接:
- HTML5 PushState的SEO和可访问性,第1部分:PushState简介: http **://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-1-introducing-pushstate/**
- HTML5 PushState的SEO和可访问性,第2部分:Backbone.js的渐进增强: http **://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-2-progressive** -加强与骨干js /
- 使用HTML5 PushState进行SEO和可访问性,第3部分:视频: http **://lostechies.com/derickbailey/2011/10/06/seo-and-accessibility-with-html5-pushstate-part-3-the-video/**
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)