Making sure your webapp is searchable
by
Jason Dent
Revinate Inc.
Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model.
The item is <span data-bind="text: priceRating"></span> today. It costs <span data-bind="text: price"></span> euros.
<script type="text/javascript"> var viewModel = {
price: ko.observable(24.95)
};
viewModel.priceRating = ko.computed(function() { return this.price() > 50 ? "expensive":"affordable"; }, viewModel); </script>
Briefly, the solution works as follows: the crawler finds a pretty AJAX URL (that is, a URL containing a #! hash fragment). It then requests the content for this URL from your server in a slightly modified form. Your web server returns the content in the form of an HTML snapshot , which is then processed by the crawler. The search results will show the original URL.
Aaaaaaaaaaaah! #! #! #!
If a lot of your content is created in JavaScript, you may want to consider using a technology such as a headless browser to create an HTML snapshot.
<html>
<head>
...
</head>
<body>
<div id="dynamic_content"
data-bind="template:
{name: 'template_pagecontent', data: $data}">
... will be filled in by rendered content from server ...
... Replaced by the knockoutjs binding ...
</div>
<script type="html/text" id="template_pagecontent">
... your html and knockout content
... that will replace dynamic_content element.
</script>
</body>
</html>
You can use a cache to speed everything up.
This is very important if you have ads on your site. The user visit will cause the ad server to hit your site immediately afterwards. So a cache will make the second call much faster.
Think about using a soft expiration date. Meaning, if you have the item in the cache, but it is a little bit out of date, serve it anyway and launch a background cache refresh.
page.onResourceRequested = function(requestData, networkRequest) {...});
To point to another location use:networkRequest.changeUrl("./blank.js");
networkRequest.changeUrl("./ga.js");
Google Analytics:
// ga.js
var _gaq = _gaq || [];
Google Tag Services (DFP)
// gpt.js
window.googletag = window.googletag || {};
window.googletag.cmd = window.googletag.cmd || [];
window.googletag.display = window.googletag.display || function(){};
We are looking for an Architect level developer for a total revamp of our frontend application using Angular JS and Bootstrap
http://www.revinate.com/about/jobs/
Jason@revinate.com