search engine technology is getting better by using Search Engine Traps

search engine technology is getting better by using Search Engine Traps Although search engine technology is getting better , it is still ...

Loading...
A+ A-

search engine technology is getting better by using Search Engine Traps

Although search engine technology is getting better, it is still not good enough to index every bit of dynamic content. This is why it is always better to stick to basic text or HTML on your web pages—in heory. In practice, that is not always feasible. If you have to use dynamic content, yet you need to ensure proper search engine rawling, you must be careful how you do it. This chapter goes over many search engine traps and how to deal with them in your code.

JavaScript Traps

JavaScript is a client-side scripting language that runs on web browsers. For the most part, you cannot see this code if you are just looking at a web page. You do get to see some of its effects when you see pop-up/pop-under windows, animations, and so forth. JavaScript-Generated Content You will want to put any content you want to index outside the JavaScript code. Here is some example code that shows dynamic text within JavaScript:
<HTML>
<head>
<title>Example of Dynamic Text</title>
<script type="text/javascript">
function defaultInfo1(){
var infoText1="";
document.getElementById('infoblock').innerHTML = infoText1;
}
function onMouseOverInfo1(){
var infoText1="Product A description goes here.";
document.getElementById('infoblock').innerHTML = infoText1;
}
function defaultInfo2(){
var infoText2="";
document.getElementById('infoblock').innerHTML = infoText2;
}
function onMouseOverInfo2(){
var infoText2="Product B description goes here.";
document.getElementById('infoblock').innerHTML = infoText2;
}
</script>
</head>
<body>
<img src="productA.jpg" onmouseover="onMouseOverInfo1()"
onmouseout="defaultInfo1();"/>
<img src="productB.jpg" onmouseover="onMouseOverInfo2()"
onmouseout="defaultInfo2();"/>
<br>
<br>
<div id="infoblock"></div>
</body>
</HTML>
If you examine the code, you will see that the text used for image mouseovers is buriedin the actual JavaScript code. Most search engines will ignore this. If you point your mouse cursor over either image (productA.jpg or productB.jpg in the code), you can see the dynamically generated text immediately below the image, as shown in Figure 8-1. In this example, the mouse was moved over the “Product A” image.

This example is frequently used in sites that want to show more information but in the same screen real estate. Here is code that achieves the same effect, but in an SEOfriendly
way:

<HTML>
<head>
<title>Example of Dynamic Text</title>
<style>
div.infoblock1 {
display:none;
}
div.infoblock2 {
display:none;
}
</style>
<script type="text/javascript">
function defaultInfo1(){
document.getElementById('infoblock').innerHTML = "";
}
function onMouseOverInfo1(){
document.getElementById('infoblock').innerHTML =
document.getElementById('infoblock1').innerHTML;
}
function defaultInfo2(){
document.getElementById('infoblock').innerHTML = "";
}
function onMouseOverInfo2(){
document.getElementById('infoblock').innerHTML =
document.getElementById('infoblock2').innerHTML;
}
</script>
</head>
<body>
<img src="productA.jpg" onmouseover="onMouseOverInfo1()"
onmouseout="defaultInfo1();"/>
<img src="productB.jpg" onmouseover="onMouseOverInfo2()"
onmouseout="defaultInfo2();"/>
<br>
<br>
<div id="infoblock"></div>
<div id="infoblock1" class="infoblock1">Product A description goes
here.</div>
<div id="infoblock2" class="infoblock2">Product B description goes
here.</div>
</body>
</HTML>
The output of this code is identical to that of the previous code. The only difference is that in this code you are placing all your text with the HTML instead of the JavaScript. Another option is to put your CSS into separate files and prohibit search engines from
accessing the CSS files within your robots.txt file. 

At the time of this writing, some rumors are circulating that Google does not index hidden (HTML) DIV tags. The premise is that search engine spammers are using these techniques to fool search engines. Although this may be true, many times this sort of functionality is necessary to present more information in the same screen real estate.

When in doubt, simply ask yourself whether the method is deceptive or designed only for web crawlers. If the answer is no in both cases, you should be fine. 
NEXT >> JavaScript Dynamic Links and Menus

Related

SEO 6490622646500554058

Post a Comment

Hot in week

Comments

Tag cloud

item