Hacker News new | past | comments | ask | show | jobs | submit login

How are you going to make Backbone calls without Javascript? I believe the author's goal was to allow his single page web app to be properly indexed by search engines (which don't execute javascript) without having to change any of his code.



What he's saying is that the views you want to be SEO'd can be generated server side and bootstrapped into Backbone (hook backbone views into an element that is rendered server side).

I currently do this too - I'll add that it is helpful to use a templating language that will work both server side and client side so you only write your templates once.

What does become a pain is doing routers/controllers both client side and server side - end up writing some code more than once and in different languages. Harder to maintain, especially when changes are made.


Right, and if you want to generate them server side, you either need to have separate templates for server side and client side, or you can execute the javascript on the server (which is what the OP decided to do).

Noone is saying there aren't other solutions to the problem, but I think the OP's solution met his goals pretty well and I thought it was a neat concept.


> you either need to have separate templates for server side and client side

there exists templating engines that run on both server and client - for example, google closure templates.


You can use cross-language templating options - personally I use mustache.

No disagreements on multiple solutions - definitely a cool approach.


So, in the past I achieved what the parent was talking about by using a templating engine that could be rendered natively by my server side language and by js. In this case it was moustache. With a little config glue my templates could be referenced from both the browser js (in which I called them in by backbone render method) and in rails (when they were rendered as partial calls in my views)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: