Search Engine Friendly Design - JavaScript
|
Javascript is one of the most common causes of "code bloat". Search engines usually only read so far down a webpage (remember, the source code, not the visible page) and if the first half of it is taken up by javascript they may give up and go away before getting to your keyword rich text.
To ensure this doesn't happen simply put all of that page's javascript in an external js file. Not only will this increase your page's search engine friendliness, it will also make it faster to load.
To create a js file use a text editor and put any javascript code that you would normally place in the
section of your web page into a separate file. This file should only contain your JavaScript code, no html. Then on your actual page, you put this in the < head > section:
< Script language="JavaScript" src="filename.js" >
< /Script >
Another solution is to place the javascript at the end of the page (in the source code) below all of the text and links. But this can sometimes cause problems with rollover buttons, interactive date scripts, banners and the like. If it does, use the external js file instead, especially if you use the same javascript on more than one page as you can call the same js file for all of them making it easier for the designer and decreasing overall download time.
It should be noted that if all of your navigation is done using javascript the search engines will not be able to follow your links. To ensure your entire site can be spidered make sure you use a noscript tag.
NEXT Step: Search Engines and CSS