Home

Web Marketing: How to Avoid Excess Web Page Code

|
Updated:  
2016-03-26 16:13:36
|
Customer Analytics For Dummies
Explore Book
Buy On Amazon

As a web marketer, avoiding excess code works to your advantage. Search engines like to see a high ratio of content to code: as few lines of code as possible per line of content. You have a few simple ways to remove code bloat and maximize the ratio of code to content.

Code using standards

If you code using XHTML and CSS standards, you can automatically minimize code bloat. These standards keep the code that controls how things look in a single, separate CSS file, and put all the content in the XHTML page. This setup maximizes that ratio of content to code.

One critical benefit of coding with standards is that you can stop using HTML tables for layout purposes. Tables are meant to display data, not graphics.

If you want to become more familiar with XHTML, take a look at HTML, XHTML & CSS For Dummies, by Ed Tittel and Jeff Noble (published by John Wiley & Sons, Inc.).

Remove inline JavaScript and CSS

Another code-bloat culprit is JavaScript that’s inserted right into the page.

image0.jpg

That JavaScript code doesn’t have to be there. Instead, you can move it into a separate .js file and include it by using JavaScript, such as

<script language="javascript" type="text/javascript" src="thescript.js">

You just removed 20 lines of bloat from your page.

You can do the same thing with blocks of CSS information.

image1.jpg

Move that CSS code to a separate .css file by using this code:

<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css">

Congratulations! You just removed another ten lines of code bloat.

When you put JavaScript and CSS information into separate files, visiting web browsers will cache the information on the users’ hard drives. They download the scripts and CSS once and then load it from their own hard drives from then on. That speeds site performance and means that you use less bandwidth. Also, by putting these files in one place, you can more easily make site-wide changes and additions.

About This Article

This article is from the book: 

About the book author:

John Arnold is a renowned marketing trainer and speaker as well as an entrepreneur and small business advisor. Arnold continues to train and advise small business owners as a Constant Contact regional development director.

Michael Becker is the managing director of North America at the Mobile Marketing Association. Becker has written more than 80 articles on mobile marketing and is an adjunct professor of mobile marketing at Golden Gate University.

Marty Dickinson is the president of HereNextYear.com, a company that combines writing, speaking, and internet strategy to help clients become recognized authorities in their fields. Dickinson also works as a business consultant to web designers and SEO specialists.

Ian Lurie has been a digital marketer for over 25 years. He created and sold the digital agency Portent, Inc. and provides consulting and training services.

Elizabeth Marsten is the senior director of strategic marketplace services for Tinuiti. Marsten has experience in Google AdWords, Microsoft Ads, Amazon Advertising, Facebook, and other platforms.