|
|
Optimizing Pages with JavaScript and Style Sheets for Search Engines... Engines use a number of criteria to decide what a given web page is all about. These ... which can be ... from Search Engine to Search Engine, and which may even change ov Background ...body of page... Example 1—mypage.html with JavaScript code We replace the JavaScript code with an instruction for the browser to go and grab the code from a separate file. The new page will look like this. ...body of page... Example 2—mypage.html with JavaScript code offloaded Note the addition of the "src" attribute to the SCRIPT tag. The value assigned to that attribute is the name of the external file that contains the JavaScript code. Typically, these external files will be given the filename extension ".js" to indicate that they contain JavaScript code. Note also that there are both tags here, even though there is nothing between those tags. A new page is then created that holds the code that was formerly held in the SCRIPT tags. We will call it "codepage.js", and it looks like this. function helloWorld(){ alert("Hello, World!"); return; } Example 3—codepage.js includes only JavaScript code This new file doesn't need any kind of HTML markup. It contains only the code that was originally held between the SCRIPT tags. Style Sheet problem In addition to JavaScript code, Style Sheet code can cause complications for Search Engines when it is put into a web page. For the same reasons as JavaScript—moving the important content further down the page, and diluting the keyword density—it is important to move Style Sheet code off of the page as well. Style Sheet solution The thought behind removing Style Sheet information from a page is very similar to that of offloading JavaScript; the syntax to do so is different. The original page, "mypage.html", may look something like this. ...body of page... Example 4—mypage.html with style sheet code We want to move this code into a separate file, so we remove it from the original page, and add a link to point to the separate file that now holds the Style Sheet code. ...body of page... Example 5—mypage.html with Style Sheet code offloaded Note the addition of the LINK tag. This contains three types of information that the browser will need to reconstruct the page when a visitor looks at it. The "rel='stylesheet'" attribute/value pair indicates that we are looking at a Style Sheet file here. The "href='style.css'" attribute/value pair points to the external file that contains the Style Sheet information. Typically these external files will be given the filename extension ".css" to indicate that they contain Cascading Style Sheet code. You will replace the filename "style.css" with the name of the actual file into which you place your stylesheet code. Finally, we have to specify the MIME type of the file, in the "type='text/css'" attribute/value pair. A new page is then created that holds the code that was formerly held in the STYLE tags. We will call it "style.css", and it looks like this. body{ background:white; color:red; } Example 6—style.css includes only Style Sheet code This new file doesn't need any kind of HTML markup. It contains only the code that was originally held between the STYLE tags. Conclusion By following these two procedures, you have now made your web page more friendly to the Search Engines. This means that the next time your page is spidered by the Search Engine robots, the important content on your page will be closer to the top of the page, and you will have a better keyword density. This will result in your page appearing higher in the Search Engine listings, and will probably bring more traffic to your website. When you are ready to put your website to work for you , it's time to contact us.Search Innovation Your Search is Over™ http://www.searchinnovation.com info@searchinnovation.com Copyright © 2002 Search Innovation. All Rights Reserved. Article Tags: Style Sheet Code, Search Engines, Search Engine, Further Down, Javascript Code, Style Sheet, Original Page,, Sheet Code Source: Free Articles from ArticlesFactory.com
ABOUT THE AUTHORDale Goetsch is a Search Engine Marketing Consultant for Search Innovation, a Search Engine Marketing company serving small businesses. His background includes over twelve years as a software tester, as well as Perl, JavaScript and ASP programming.
|
||||||||||||||||||||||||||||||||||||||||||
Partners
|