First we made the choice to embed v8 in MVC.net and WebApi and implement the templates with underscore or mustache to keep exactly the same templates.
Even if you have the same templates, the rendering logic can be different and you need constantly to refactor the templates, the frontend views and the backend views. Specially if you are doing a restfull api.
We finally choose an other solution to provide non javascript alternative for accessibility and seo requirements using a headless browser (PhantomJs) to render the pages.
It's quite easy to implement, you need to install PhantomJs on your server, add a javascript to render completely the page with all the javascript interactions and serve the html output.
You can found an example of use here : http://backbonetutorials.com/seo-for-single-page-apps/
The example is for node.js but it's easy to implement it with ASP
The phantom script we use is similar :
//phantom-server.js
var page = require('webpage').create();
var system = require('system');
var lastReceived = new Date().getTime();
var requestCount = 0;
var responseCount = 0;
var requestIds = [];
var startTime = new Date().getTime();
page.onResourceReceived = function (response) {
if(requestIds.indexOf(response.id) !== -1) {
lastReceived = new Date().getTime();
responseCount++;
requestIds[requestIds.indexOf(response.id)] = null;
}
};
page.onResourceRequested = function (request) {
if(requestIds.indexOf(request.id) === -1) {
requestIds.push(request.id);
requestCount++;
}
};
// Open the page
page.open(system.args[1], function () {});
var checkComplete = function () {
// We don't allow it to take longer than 5 seconds but
// don't return until all requests are finished
if((new Date().getTime() - lastReceived > 300 && requestCount === responseCount) || new Date().getTime() - startTime > 5000) {
clearInterval(checkCompleteInterval);
console.log(page.content);
phantom.exit();
}
}
// Let us check to see if the page is finished rendering
var checkCompleteInterval = setInterval(checkComplete, 1);
There is also services that provide you the same result : http://prerender.io/