o you have lots of the search bot will see the
JavaScript coding in the keywords before giving up and
header section of your web moving on to the next page.
pages? Do you re-list your CSS
styles at the top of every page? But what do you do if you have
Do you have JavaScript coding lots of JavaScript code or CSS
spread throughout your web pages? styles pushing your keywords down
the page in your coding? You need
If you answered yes to any of to find a way to cut down on all
these questions your site may be that code that gets in the way of
driving away search engine the search engines properly
spiders and losing search engine indexing your page.
position ranking.
We do this by moving the
As you can imagine search engine JavaScript and CSS styles off the
spiders have a lot of pages to page and into external files.
get through on the web when they This is a fairly easy and
are indexing sites. To improve straight forward process and can
their speed and efficiency search have the added benefit of making
engines program their spiders to your pages load faster as well,
give up easily if they have which the search engines also
problems with a page or if they like.
have to wade through too much
code to find the relevant In many ways CSS styles and
content. JavaScript work in a similar
fashion. You set up functions in
This is one of the reasons why it a script or formatting in a style
is so important to put your sheet section, and then refer to
keywords as close to the top of that section in your html code.
the page as possible. This way For instance if you have a
JavaScript that displays a clock every page that the code had been
on your page you would have the copied onto.
JavaScript functions for the
clock listed in your head Both of these problems can be
section, then you would simply solved simply by using external
call that function from the place files. You create one external
on the page where the clock would file for your CSS and another
be displayed. file for your JavaScript. These
could be named mysite.css for the
Similarly with CSS you set up CSS and mysite.js for the
your styles ahead of time in a JavaScript. These files can be
Styles section of the page head, created in any plain text editor
then you simply refer to the or html code editor, they are
styles as needed in your html nothing more than files that
coding. One benefit of this is contain most of the CSS or
that it cuts down dramatically on JavaScript code from the web
the amount of formatting code pages.
needed when compared to using
Font tags. With JavaScript you have an
opening JavaScript tag, then a
If you want to use the same comment tag, then assorted
JavaScript or CSS styles on a functions and what not, followed
different page you could copy all by a closing comment tag and a
that code onto the new page. But closing JavaScript tag. Your
this would cause two distinct external file would start with
problems, first you would be the opening comment tag, contain
adding a lot of code to each page all the functions and such, and
and second if you wanted to make end with the closing comment tag.
a change to the JavaScript or CSS You would leave both the opening
styles you would need to do so on and closing JavaScript tags in
the html page. If you have more Placing CSS styles in an external
than one JavaScript on the page file is handled in exactly the
you can move all the code into same manner. Move the styles into
one external js file. Simply copy the external file, and then refer
it into the file in the same to that external file with your
order as it exists in the style tag in the head section of
JavaScript tags on the html page. the web page like this:
You will only need the one pair
of opening and closing comment link href="mysite.css"
tags. rel="stylesheet" type="text/css"
Once your JavaScript is moved off An added benefit of moving the
the page you will need to tell code into external files is that
the web page where to find it. you can then change the styles of
This is done in the JavaScript your whole site simply by
tag that was left on the page in changing the code in the one
the head section. Right now this external file.
will be an opening JavaScript tag
placed right up against the Once you have moved the code into
closing JavaScript tag, with no external files you will have
additional code in between. You greatly simplified the code on
will place the reference to the each page. This will take you a
external JavaScript code inside long way towards making your
the opening JavaScript tag like pages lean and mean, and very
this: search engine friendly.
script language="JavaScript" You can find sample external
type="text/JavaScript" files for this article on my web
src="mysite.js" site at:
www.howtogurus.com/free-articles.
html Copyright 2005 - George Peirson
About the Author:
George Peirson is a successful Entrepreneur, Internet Trainer and author of over 30 multimedia based tutorial training titles. Read more
articles by George Peirson at www.howtogurus.com/free-articles.html
Read more articles by:
George Peirson
Article Source: www.iSnare.com