Keeping Pages Lightweight
Keeping the source code of your pages lightweight helps in a number of areas. Size and usability are two of the main areas that are important to both the visitor and to you the page creator.
The size of the page that you are delivering to the visitor is not that important these days with broadband becoming more popular. “Chunky” pages can be downloaded in a couple of seconds with high-end download speeds nowadays. The bandwidth of your server or site account can be affected though, not much I admit, but can make some difference on high traffic sites. Search engines also usually only cache no more than 150Kb of any page.
To me usability is as important subject as SEO. Now in this case when I say usability, I am talking about the coder’s ability to work with the code. In large projects, it is important to make updating parts of pages and the site as easy as possible.
Now to explain a couple of ways to make sure that your pages, and ultimately your whole website, is lightweight.
Including or importing the page’s Cascading Style Sheets (CSS) and JavaScripts is one method of lightening the load. You will see some examples below. When you do use this inclusion method, visitors to your site will cache the CSS and JavaScript files on their computers and therefore will only have to be downloaded once. This will speed up subsequent page visits and will reduce downloads.
Examples
Use the codes below to include your CSS and JavaScript:
Keep in mind that any JavaScripts or CSS that is specific to one page can still be external to that page to save on downloading it each page view. And another tip, use as much of the CSS file as possible; remove as much of the styling code from the html as possible and put it all into the CSS file.
Remember, keep your pages lightweight!
