SEO for Backbone.js app on Apache server - phantom.js and node.js?

I am working on a site backbone.js / marionette, which should be optimized by search engine (SEO). We use the java / spring RESTful server and the Apache 2.2 web server. I am currently involved in implementing pushstate in our application while it is in its early stages.

What I came up with as a solution:

  • For regular users with browsers that support javascript, use a purely client-side base implementation.
  • Use Apache mod_rewrite to route all the paths to our index.html page with an intact outline, so backbone.js returns the correct page, and url retains its shape. I am working correctly (minus one error).
  • Sniff for bots / crawlers using the Apache httpd.conf file and create rewrite rules to redirect bots to our node.js.
  • Create html / content with phantomjs and return this to your web browser.

We do not need the site to be fully functional for the bot, but it must return the correct content. We use mustache templates, but we need a DRY website and we feel that any kind of rendering a java template will become incredibly messy as the site grows. We hope that this site has existed for many years and are not trying to connect to a ton of third-party libraries (at least not much more than we already have).

Does anyone have any experience or advice on this topic? Of my research, others are a little wary, especially this related question . I am somewhat worried if the "click" bots are in javascript or executing receive requests. Thoughts and advice?

Thank you very well in advance.

+6
source share
1 answer

Very bad idea, sorry, I'm so dumb.

What you want to do is the following:

If I delete http://yoursite.com/path/to/resource using a direct HTTP request, then your server will serve me via html for this resource page, and then if you WANT you can use javascript at this point. to β€œinitialize” one aspect of the page. From there, if I go through AJAX and trunk routes, all this is good from there. If I then copy the URL, close my browser and then paste it when I open again, I should expect to see the same html.

This approach turned out to be the best approach not only for SEO, but also for the conceptual design of your system, as well as to ensure "work" for all not only fast browsers with JS support.

What you want to avoid at all costs is trying to trick searchers and serve them other content than what the user sees ... this is a recipe for a blacklist.

In the end, design your website so that if you type the URLs through http, you will get the full html, and if you click the same URL in ajax mode with a single-page application, you will get the partial one that you need everything it synchronized .... better architecture, fewer SEO blacklists!

+3
source

All Articles