Search Engine Optimization Tips and Tricks – Learn how to increase visibility in Search Engines – Part 34 – What happens when you have too much inline script code and CSS ..

The previous post talked about the use of frames (Frames and SEO) in your site, and how this impacts your SEO efforts and your ranking. In this post, we will talk about another common practice indulged in by a number of page owners, and which can impact their rankings. This is related to having scripting and CSS code inside their web pages, mixed with content. For some time now, a number of sites have been advocating that such scripting and CSS should be moved to linked files rather than inside the common page. In this post, I will explain the reasons for the same, and implications on Search Engine Optimization.
It may seem very convenient to put scripting code and CSS within pages (or use PHP server side functions to insert the code inside the page when the server is rendering the page). However, it causes problems to search engines. When you have all these content in the page content files, it causes the page to bloat up and the search engine crawler has to do more searching to find the actual content in the files (and you do want you actual content to be easily found by the search engines, not the ‘beautifully’ created code and CSS files that look like junk to the search engines). Given the amount of content that search engine crawlers have to go through (after all, they have to content the entire universe of content on the web), if a page seems very long and complicated and slow to search engine crawlers, they can very ignore such content and move on. You need to make it easier for them to find the relevant content in your pages. Further, the closer that content is to the start of your HTML page, the better (and when you have code and CSS that is present, it is typically above the content and hence likely to make it more difficult for your content to be found by the search engines).
What can you do ? Well, you can move all your script and CSS code to a separate file that is called from within your page. Of course, it does not mean that you need to take all your code and just move it to a file, there will need to be references to this file in the page; this will need to be done carefully and tested to make sure that it works and there was no slipup in the process of doing this. However, once it is done, then there are no further issues and the reader will be unable to make out any difference (unless the more technically interested reader looks the source of your file). And of course, such external files are also cached by some browsers, so if your readers frequently come to your site, the same files will not be loaded again and again and will enable faster loading.
One final advantage, and this is of benefit to you. If you keep your scripting code and CSS in a separate file that is being called by other pages, then any maintenance needed on your code or CSS is much easier and less messy.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>