Search code examples
javascriptbackbone.jsseo

SEO for a backbone js heavy page


We use backbone heavily for rendering our pages. All the data is passed as json from the server and the html is created on the client with backbone and mustache. This poses a big problem for SEO. One way that I was planning to get around this was to detect if the request is from a bot and use something like HtmlUnit to render the page on the server and spit it out. Would love some alternate ideas. Also would like to know if there's a flaw in what I'm planning to do.


Solution

  • I don't necessarily like that the only option you have for answers are to redo everything to meet a broad best practice. There's good reason to consider doing things using an unobstrusive Javascript approach, but maybe there's a good reason you're doing this as a JS-required site. Let's pretend there is.

    If you're doing a Backbone.js application with dynamically filled in client templates, the best way I could think of to do this is in the link below. Basically, it amounts to telling a headless browser to run through a set of navigation commands to view all your users/products/pages and save a static html file at every step for SEO reasons.

    What's the least redundant way to make a site with JavaScript-generated HTML crawlable?