This article has been updated and combined into a newer article, found here: On-Page Search Engine Optimization Techniques. We are keeping this older one up for archival purposes only.

Much of search engine optimization has to do with the technical aspects of how you code your site. The purpose of this article is to outline the various aspects of your HTML code that can have an affect on search engines. What this article will not cover is meta and title tags, for information on them see our article: Meta and Title Tags.

Source Code Formatting

It is important to take source code formatting into account when trying to optimize your site for search engines. Search engines don't see web pages as we do, nicely formatted HTML with graphics, they only see your source code in all its raw HTML and Javascript glory, and because of this how your source code is formatted can affect how highly you rank.

Now every search engine is different, and trying to nail down the algorithm for each at any one time is an exercise in futility since they are always changing it. So instead of details, I will give you general guidelines to follow for all search engines.

Some search engines have limits on how much of each page they index. If you have long javascript, CSS information, and just about anything else above your content then it can hurt your rankings by allowing the search engine to index less of your content. Additionally some engines will rank you by keyword frequency, and if you have all of this extraneous text then your frequency will be lower. As a general rule you should remotely include everything possible. So get that Javascript and CSS out of your source code and put it in external files. Doing so will help avoid the pitfalls mentioned above.

You also have to remember that spiders will read from top to bottom, and because of table formatting your first line of content might be halfway down the page in your source code, maybe even farther. So keep this in mind when designing your layout, if at all possible use a configuration that allows you to put your content as near the top as possible. Of course having your menu cut off is an equally unattractive option. To be perfectly honest, for most people this really shouldn't matter, it won't hurt to take the precautions but this is not an issue that has a lot of teeth. In general you only need to start worrying about this once your raw HTML pages (not counting images) pass 100kb in size. Just remember it always better to lose 10% of your content than 100% of your menu since your menu is what search engines use to navigate your site.