Optimizing Pages with JavaScript and Style Sheets for Search Engines

Written by Dale Goetsch


Search Engines use a number of criteria to decide what a given web page is all about. These criteria, which can be different from Search Engine to Search Engine, and which may even change over time, all aim at deciding how "relevant" a page is to a given user's search. The Search Engine wants to returnrepparttar results most relevant to a user's search.

Whilerepparttar 128030 particulars may change over time, there are some criteria which remain constant. One of these is whererepparttar 128031 keywords are located onrepparttar 128032 page. Typically words that are located closer torepparttar 128033 beginning of a page are considered more important than words that occur further downrepparttar 128034 page. This stands to reason: think of a newspaper article, whererepparttar 128035 headline andrepparttar 128036 first paragraph usually have more "meat" thanrepparttar 128037 rest ofrepparttar 128038 story.

Another measure of relevance is "keyword density". This is roughlyrepparttar 128039 ratio of keywords on a page torepparttar 128040 total number of words on a page. Having a higher ratio of keywords to total words will make a page more relevant for a search on those keywords.

When a Search Engine sends its robot out to look at your page, you want to make sure that it finds important information nearrepparttar 128041 top ofrepparttar 128042 web page, and thatrepparttar 128043 page has a high keyword density. Sometimes there are complications, even when you have a lot of keyword-rich text early inrepparttar 128044 visible portion of your page. Two of these complications, extensive JavaScript code and extensive Cascading Style Sheet code, can be easily remedied.

JavaScript problem

Large amounts of JavaScript code can get inrepparttar 128045 way. Typicallyrepparttar 128046 largest amount of JavaScript code in a web page is found inrepparttar 128047 HEAD section. This is usually where variables and functions are defined, and so forth.

Unfortunately, having a large amount of JavaScript code in a page can be detrimental to a page's ranking inrepparttar 128048 Search Engines.

Since Search Engines tend to pay more attention to text atrepparttar 128049 beginning of a web page than they do to text further fromrepparttar 128050 beginning, it stands to reason that if you have several dozen lines of JavaScript code atrepparttar 128051 top ofrepparttar 128052 page, your real content is going to be further fromrepparttar 128053 beginning ofrepparttar 128054 page. Further downrepparttar 128055 page means less important torepparttar 128056 Search Engine.

Keyword density is also important. Here again, if you have several hundred words of JavaScript code in a page,repparttar 128057 keyword density—the ratio of your keywords to allrepparttar 128058 words inrepparttar 128059 whole page, both text and code—is going to be much lower. That means that some Search Engines will decide that your page is less relevant.

JavaScript solution

So how do you maintain JavaScript functionality, but make your page as Search Engine-friendly as possible? You putrepparttar 128060 JavaScript code into a separate file, and link it back torepparttar 128061 web page.

The original page, "mypage.html", may look something like this.

My Title< itle> <script> function helloWorld(){ alert("Hello, World!"); return; } </script> </head> <body onLoad="helloWorld()"><p> ...body of page...<p></body> </html><p>Example 1—mypage.html with JavaScript code<p>We replace<IMG height=12 src="/the2.jpg" alt="repparttar 128062"> JavaScript code with an instruction for<IMG height=12 src="/the2.jpg" alt="repparttar 128063"> browser to go and grab<IMG height=12 src="/the2.jpg" alt="repparttar 128064"> code from a separate file. The new page will look like this.<p><html> <head> <title>My Title< itle> <script src="codepage.js"></script> </head> <body onLoad="helloWorld()"><p> ...body of page...<p></body> </html><p>Example 2—mypage.html with JavaScript code offloaded<p>Note<IMG height=12 src="/the2.jpg" alt="repparttar 128065"> addition of<IMG height=12 src="/the2.jpg" alt="repparttar 128066"> "src" attribute to<IMG height=12 src="/the2.jpg" alt="repparttar 128067"> SCRIPT tag. The value assigned to that attribute is<IMG height=12 src="/the2.jpg" alt="repparttar 128068"> name of<IMG height=12 src="/the2.jpg" alt="repparttar 128069"> external file that contains<IMG height=12 src="/the2.jpg" alt="repparttar 128070"> JavaScript code. Typically, these external files will be given<IMG height=12 src="/the2.jpg" alt="repparttar 128071"> filename extension ".js" to indicate that they contain JavaScript code. Note also that there are both <script> and </script> tags here, even though there is nothing between those tags. <br><br></font></td><!-- google_ad_section_end --><!-- google_ad_section_start(weight=ignore) --><td align="top" width="10%"></td><td align="top" width="45%"><h2>Getting Honest With The Search Engines</h2><font size="2">Written by Daria Goetsch</font><br><br><script type="text/javascript"><!-- google_ad_client = "pub-5766870852072819"; google_ad_width = 234; google_ad_height = 60; google_ad_format = "234x60_as"; google_ad_channel ="9238851329"; google_color_border = "CFB9A1"; google_color_bg = "CFB9A1"; google_color_link = "000000"; google_color_url = "431B02"; google_color_text = "431B02"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <br> <font size="2">I spend a lot of time reading newsletters and forum postings about Search Engine Marketing. More often than not, people are asking about methods used to improve Search Engine rankings: what works, what doesn't, and what will get you in trouble.<p>Search Engine*: A program that searches documents for specified keywords and returns a list of<IMG height=12 src="/the2.jpg" alt="repparttar "> documents where<IMG height=12 src="/the2.jpg" alt="repparttar 128029"> keywords were found. <p>Algorithm*: A formula or set of steps for solving a particular problem. <p>Frankly, no one can predict what will happen from day to day with<IMG height=12 src="/the2.jpg" alt="repparttar 128030"> Search Engines. Only<IMG height=12 src="/the2.jpg" alt="repparttar 128031"> Search Engine companies themselves know if<IMG height=12 src="/the2.jpg" alt="repparttar 128032"> algorithms will change from one day to<IMG height=12 src="/the2.jpg" alt="repparttar 128033"> next. Even<IMG height=12 src="/the2.jpg" alt="repparttar 128034"> Search Engine rules change from month to month, sometimes daily. Think of<IMG height=12 src="/the2.jpg" alt="repparttar 128035"> changes that have happened since pay for inclusion and pay-per-click have taken over<IMG height=12 src="/the2.jpg" alt="repparttar 128036"> market for Search Engine results.<p>It seems so simple to try and comply with<IMG height=12 src="/the2.jpg" alt="repparttar 128037"> Search Engine rules. Even though optimization adds to<IMG height=12 src="/the2.jpg" alt="repparttar 128038"> basic content of a site and source code, there are ways to approach this without stepping over<IMG height=12 src="/the2.jpg" alt="repparttar 128039"> line.<p>We personally do not use<IMG height=12 src="/the2.jpg" alt="repparttar 128040"> methods mentioned below (methods to avoid, methods to be wary of) in order to play it<IMG height=12 src="/the2.jpg" alt="repparttar 128041"> absolute safest way, using a long term plan in providing you optimum ranking in<IMG height=12 src="/the2.jpg" alt="repparttar 128042"> Search Engines.<p>Methods to avoid<p>Keyword stuffing. "Stuffing" keywords into places where keywords don't belong, such as comment tags, image ALT tags where<IMG height=12 src="/the2.jpg" alt="repparttar 128043"> keywords have nothing to do with<IMG height=12 src="/the2.jpg" alt="repparttar 128044"> specific image <p>Invisible text. Text color<IMG height=12 src="/the2.jpg" alt="repparttar 128045"> same as background color <p>Automated submissions. Using automated tools to deliver huge numbers of pages to submission pages of Search Engines Submissions to "thousands" of Search Engines. A waste of time, since<IMG height=12 src="/the2.jpg" alt="repparttar 128046"> major Search Engines/Directories drive<IMG height=12 src="/the2.jpg" alt="repparttar 128047"> majority of<IMG height=12 src="/the2.jpg" alt="repparttar 128048"> traffic to websites FFA (free for all) links. Link popularity is good, but only when<IMG height=12 src="/the2.jpg" alt="repparttar 128049"> links are relevant; a link from a page of random links is not worth nearly as much as a link from a site that is relevant to your site <p>Search Engine Marketing companies hosting your pages on their server. The marketing company "owns" your pages, and if you decide you want to move them, you may have a hard time wresting them away. (This is not always<IMG height=12 src="/the2.jpg" alt="repparttar 128050"> case with marketing companies that also provide hosting, but you need to carefully choose when using this option.) <p>Methods to be wary of<p>Cloaking Doorway pages Maintenance programs <p>Cloaking*: <p>Also known as stealth, a technique used by some Web sites to deliver one page to a Search Engine for indexing while serving an entirely different page to everyone else. <p>Cloaking is very difficult to do correctly, if you do not have an expert providing this service you could well be banned by<IMG height=12 src="/the2.jpg" alt="repparttar 128051"> Search Engines. There are ways for this to be done that are accepted by some Search Engines. In general, cloaking is not always accepted by<IMG height=12 src="/the2.jpg" alt="repparttar 128052"> Search Engine rules and can be a gamble unless you are certain your service provider knows what they are doing. Check credentials and get referrals from people who have used their services.<p>Doorway page**: <p>A page made specifically to rank well in Search Engines for particular keywords, serving as an entry point through which visitors pass to<IMG height=12 src="/the2.jpg" alt="repparttar 128053"> main content. <p>Doorway pages are not accepted as they used to be by<IMG height=12 src="/the2.jpg" alt="repparttar 128054"> Search Engines. A carefully crafted doorway page done by hand is entirely different from an automated doorway page generated by software. A few well-designed pages are a far cry from mass generated automated pages sent in large numbers through<IMG height=12 src="/the2.jpg" alt="repparttar 128055"> Search Engine submission page, which are often considered as spam. Again, check credentials and get referrals from people who have used their services.<p>Maintenance programs<p>There are times when a page drops from<IMG height=12 src="/the2.jpg" alt="repparttar 128056"> Search Engine listings or you re-design<IMG height=12 src="/the2.jpg" alt="repparttar 128057"> page which might give you a reason to re-submit<IMG height=12 src="/the2.jpg" alt="repparttar 128058"> page to<IMG height=12 src="/the2.jpg" alt="repparttar 128059"> Search Engine. Re-submitting your pages every month is not always necessary. Having a log stats program in place will help you see which pages are still listed, along with a monthly ranking report. If you have these tools you should be able to see if any of your pages have changed. Be wary of people who consistently re-submit your pages, since re-submission can sometimes cause your pages to be dropped if they are already listed in<IMG height=12 src="/the2.jpg" alt="repparttar 128060"> database. <p>My own experience with a very large website I did Search Engine marketing for, showed that<IMG height=12 src="/the2.jpg" alt="repparttar 128061"> older (longer)<IMG height=12 src="/the2.jpg" alt="repparttar 128062"> pages were in<IMG height=12 src="/the2.jpg" alt="repparttar 128063"> Search Engine results,<IMG height=12 src="/the2.jpg" alt="repparttar 128064"> better for link popularity and ranking. Of course, paid inclusion can give you more security in having your web pages stabilized in<IMG height=12 src="/the2.jpg" alt="repparttar 128065"> Search Engine results. <br><br></font></td><!-- google_ad_section_end --></tr><tr><td>Cont'd on page 2 ==<a class="mlink" href="2-Optimizing_Pages_with_JavaScript_and_Style_Sheets_for_Search_Engines-28030.htm">></a></td></tr></table><script type="text/javascript"><!-- google_ad_client = "pub-5766870852072819"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_channel ="8831454965"; google_color_border = "CFB9A1"; google_color_bg = "CFB9A1"; google_color_link = "000000"; google_color_url = "431B02"; google_color_text = "431B02"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </td> </tr> </table> <table width="770" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> <tr> <td height="48" align="center" background="images/bg_nav_bottm.jpg"><span class="style3">ImproveHomeLife.com © 2005<br> <a href="terms.html" rel="nofollow">Terms of Use</a></span></td> </tr> </table></td> </tr> </table> <script type="text/javascript"> var HASH_ESCAPED="%23"; function TrackIt(adUnit){ if (window.status) { var adDomain = escape(window.status.substring(6)); var pyPage = document.location.pathname; var params = document.location.search; var hasAnchor = params.lastIndexOf(HASH_ESCAPED)!= -1; params = hasAnchor? (params.substring(0, params.lastIndexOf(HASH_ESCAPED))) : params; pyPage = escape(pyPage.substring(pyPage.lastIndexOf('/') + 1)); pyPage = pyPage + params; var curTime = new Date().valueOf(); var bug = new Image(); bug.src = '/track/adsenseTrack.php?pyPage=' + pyPage + '&adDomain=' + adDomain + '&adUnit=' + adUnit + "&time=" + curTime; } } function TrackIt0() {TrackIt(0); } function TrackIt1() {TrackIt(1); } function TrackIt2() {TrackIt(2); } var elements = document.getElementsByTagName("iframe"); for (var i = 0; i < elements.length; i++) { if(elements[i].src.indexOf('googlesyndication.com') > -1) { //elements[i].onfocus = TrackIt; if (i==0) elements[i].onfocus = TrackIt0; if (i==1) elements[i].onfocus = TrackIt1; if (i==2) elements[i].onfocus = TrackIt2; } } </script> <!--WEBBOT bot="HTMLMarkup" startspan ALT="Site Meter" --> <script type="text/javascript" language="JavaScript">var site="s19improve"</script> <script type="text/javascript" language="JavaScript1.2" src="http://s19.sitemeter.com/js/counter.js?site=s19improve"> </script> <noscript> <a href="http://s19.sitemeter.com/stats.asp?site=s19improve" target="_top"> <img src="http://s19.sitemeter.com/meter.asp?site=s19improve" alt="Site Meter" border=0></a> </noscript> <!-- Copyright (c)2002 Site Meter --> <!--WEBBOT bot="HTMLMarkup" Endspan --> </body> </html>