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