views:

128

answers:

1

Scott Guthrie just blogged about the new jQuery Templates that his team has been working on, and I must say... this looks really sweet. I have a multi-part question however, where the answer will influence my decision to use them.

I'm currently working on a project whereby the home page displays a list of upcoming events in your region. The event listing is much the same as that in http://nerddinner.com (but I'm not using any of their code).

I'm thinking about using the new jQuery Templates to format the information sent from my Controller (MVC). The current way I'm doing this is to send the ViewModel Object to the view (with all of the needed content), but to ALSO serialize the same ViewModel Object into JSON (passed using ViewData) that is used by the Bing Maps. Now I'm assuming that there's a performance hit in sending the same content twice, and therefore I think that sending JSON only and using it for both the Bing Maps and the content (using jQuery Templates) is a great idea.

In walks my question. Can search engines read the JSON in the page (and if so, will they use it for indexing), or are my pages going to be "blank" to the search engine because I'm displaying the content AFTER the page renders? The second part of this question is that, IF SEO will be affected, is there a better way of accomplishing what I need, or am I stuck sending the content twice? (remember, the map info and the content info will be exactly the same).

+3  A: 

The templates are all JavaScript at the moment, something a crawler isn't going to execute. Google support AJAX enabled sites in a certain format...but no you won't see crawler support for this, at least not in the new future.

If anything, it'll hurt SEO...the price you pay for using newer technologies/formats the crawlers aren't designed to handle yet.

Warning: This answer has a shelf-life (hopefully) and should be invalid at some point (current date - Oct 05, 2010)...someone please edit me when this happens (and search engines handle this well).

Nick Craver
This is exactly what I thought. Damn these templates look friggin' sick tho. Can you speak to the "performance hit" piece, and possibly offer a solution/suggestion? (I've edited my question)
rockinthesixstring
ps: nice warning... lol.
rockinthesixstring
@rockinthesixstring - There is a performance piece, the browser taking markup to elements is going to be less expensive than taking templates to markup *then* to elements...though document fragment caching should provide some benefits for larger templates...so I can't say for certain how much impact, it's going to vary by scenario. I'll be using the templates for several cases....but I don't have to care about SEO :) Possible solution: you could render the page differently to the engine, as long as the results are identical, don't "lie" to the crawler though...it's not ideal though.
Nick Craver
@rockinthesixstring - In the future the date above my name will turn into a date, once it's past a few days old ;)
Nick Craver
yeah, I could send "content" to the crawler and JSON to the real world (and format it identical). This is an option... Basically separate views with an identical result depending on crawler or visitor. I'm already managing sitemaps this way ( [see my blog](http://dotnetblogger.com/post/2010/08/23/MVC-ActionFilterAttribute-for-managing-web-crawlers-%28Google-Bing-Yahoo!%29.aspx) )
rockinthesixstring
@Nick - yes this is true. habit I suppose.
rockinthesixstring
@Nick - alternatively, can I send that same content to a "noscript" tag for the non-js stuff... however that doesn't thwart the performance issue.
rockinthesixstring